In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Extracting column headings from multiple files within a folder

alteryxocean
5 - Atom

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!

 

 

1 REPLY 1
DataNath
17 - Castor
17 - Castor

Hey @alteryxocean, how does something like this look? As you can see, I've got 3 different files here of different types:

 

DataNath_0-1668613534457.png

 

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):

 

DataNath_1-1668613671736.png

 

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:

 

DataNath_2-1668613724808.png

 

When we run the main workflow, we then get the headers from all 3 files as needed:

 

DataNath_3-1668613765827.png

 

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.

Labels
Top Solution Authors