Hello Alteryx community,
I am looking for guidance on the below scenario.
Situation: I have a folder with multiple files. The files can be csv, text or other formats. Each file in the folder has different column header names.
Requirement: I want to create an Alteryx workflow that will save a csv /text file with the name of file as the first column and the column headers as subsequent columns for all the files within the folder.
Thanks!
Hey @alteryxocean, how does something like this look? As you can see, I've got 3 different files here of different types:
Now, my solution is an adaptation of the following weekly challenge: https://community.alteryx.com/t5/Weekly-Challenge/Challenge-180-Thousand-File-Challenge/td-p/461356
Using a lookup table, we can feed in the file format - based upon the file extension - to one of the control parameters of the batch macro. The second takes in the full filepath (once we've filtered the data to remove nulls i.e. temp files etc):
Within the batch macro itself, we just output the file name from the Input Data tool, and then use Field Info to create a new column of just field names from that file:
When we run the main workflow, we then get the headers from all 3 files as needed:
Hope this helps - please let me know if you have any questions! There will be a limitation if you're trying to use unsupported file types, or those that weren't provided as part of the lookup table.