Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Macro to combine multiple Excel sheets from the latest file picked by Directory Tool

Shakil1
8 - Asteroid

Hi Alteryx Community,

 

I'm looking for macro to combine multiple Excel sheets from the latest file picked by Directory Tool, where only one sheet has headers and the others do not.

 

I’m working with an Excel file that contains multiple sheets:

  • One sheet (e.g., "Full Data") contains column headers and full data.

  • The other sheets (e.g., "DataOnly1", "DataOnly2", etc.) contain only data without headers.

Each sheet has the same structure (same number and order of columns), but only one sheet provides the correct column names.

 

I would like to create a macro in Alteryx that:

  1. Takes sheet names dynamically as input (e.g., from a list).

  2. Reads each sheet, whether it has headers or not.

  3. Applies the headers from the “Full Data” sheet to the data-only sheets.

  4. Combines all sheets into one unified dataset.

Once the macro is built, I plan to use it inside my main workflow and connect it to the Directory Tool to loop through multiple Excel files and process all their sheets accordingly.   Below is the example screenshot for your reference.   Thanks!

 

 

 

Shakil1_0-1750330008516.png

 

Shakil1_1-1750330136403.png

 

1 REPLY 1
caltang
17 - Castor
17 - Castor

I'm glad to see you try your hand at it - but this is your original post: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Urgent-Macro-to-combine-multip...

 

Updating the comments there might be more useful to give users context rather than starting a new thread. 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels
Top Solution Authors