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.

Run workflow for multiple sheets and join horizontally

elam
5 - Atom

Hello,

 

I have a built a routine that inputs different periods of data to populate a template.  I only use one input file with multiple sheets that include different 10 year periods of data. The sheets are labeled consistently (Period 1, Period 2, etc.) and follow very similar formats, but have differing field names (e.g. Period 1 includes 2022, 2023, ... 2031 but Period 2 includes 2032, 2033, ...).  As shown below, my routine performs some scrubbing procedures and uses the data to populate the standardized template, and then joins each period horizontally.  See below:

elam_0-1678299432372.png

 

Depending on when I run this routine, I will have differing numbers of periods. Instead of manually updating the input tools and disabling containers for irrelevant periods every time, I would like to use batch macros to dynamically run the grey part of the workflow for all sheets included in a given input file, and then join these horizontally.

 

I've read through a million posts on batch macros, but am having trouble appending the results of the workflow.  Any advice?

1 REPLY 1
Yoshiro_Fujimori
15 - Aurora
15 - Aurora

@elam ,

 

If the input sheets has different field names, I would "Transpose" the fields to standardize the metadata of output from the batch macro.

Yoshiro_Fujimori_1-1678597130107.png

To read multiple sheets, first the the sheet names to a list and pass the file path + sheet name to the "Input Data" tool within a macro.

Yoshiro_Fujimori_2-1678597165438.png

 

After all the sheets are processed, the table format can be changed using "Cross Tab" if necessary for further processing.

Yoshiro_Fujimori_3-1678597201482.png

 

Yoshiro_Fujimori_0-1678597114576.png

Does it work for you?

Labels
Top Solution Authors