Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Loop through files and skip lines


I just want to loop through a bunch of excel files, combining the data, but always skipping the first 5 rows. That works for the first file, but the next iteration will not skip the rows:




Any idea?


Hi @ms809! I would use a batch macro. I think you can copy your Dynamic Input and Sample tools to a new a new canvas, add a macro input and macro output, throw some default data into the edit data option on the macro input, and then change it to a batch macro on the workflow tab before saving it. You can then add this macro on your original workflow in place of the dynamic input and sample, connect the formula tool to both connections on the batch macro, and select whatever field your dynamic input is using as a grouped field in both boxes of the macro configuration.


That can be confusing if you've never used batch macros before, so I've attached a sample where it will read in any xlsx file you give it and skip the first 5 rows. It should help in case you get stuck on any of the above steps.


How is the Sample tool configured?


It should work the way you have it. I configured it as so and it skipped the first 5 records for every Excel file within the directory:


EDIT: I just realized you may not have selected a field to group the sample. I selected the FileName for grouping, and I'm sure that Full Path would work as well.