Rearrange CSV Columns
Tom_153935 Posts: 76
I found myself needing to rearrange the columns in a CSV file. I came up with a fairly quick 2-step method:
- Text: create text file.
- In File Content, put a comma-separated list of the column headers in the order that you want.
- In File name and extension give it a .csv name.
- CSV: Update file with another file.
- In Master File, put the field reference of the file you created in (1).
- In Inbound File, put the field reference of the file you want to rearrange.
- In Key Column put the name of one of the columns that is in both the Master File and the Inbound File.
- For the T/F questions, put T F F F T.
Et voilà! Step 1 creates a CSV file with only the headers in the order specified. Step 2 inserts data into that file. Note that Step 2 does not necessarily insert the rows in the same order that they appear in the inbound file.