- 29 May 2023
- 2 Minutes to read
- Print
- DarkLight
Merging CSV Files into an Excel File
- Updated on 29 May 2023
- 2 Minutes to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.18.0 |
Root Folder | Example Lab - Merging CSV Files into an Excel File |
Modules | None |
Dependencies | None |
This Example Lab demonstrates how to merge CSV files into a single Excel file by saving them into different worksheets and how to download the Excel file in a Form.
Explanation
The Create New Excel File step creates the Excel file for saving the CSV files' data. This project requires the user to input CSV files to the Parent Flow labeled "CSVFiles" at the start step of this example Flow. Example CSVs are included within the Project Download. The ForEach step accepts "CSVFiles" as its input, so it loops given the number of CSV files uploaded by the user. Each loop passes the file into the provided "Merge CSV" Flow which transfers the data from each file row by row into the created Excel file.
Within this Flow, the Create Data and Add steps create a counter differentiating one row from another. The Add Work Sheet step creates a worksheet in the Excel file to save this CSV's data. The Flow then begins to gather the data row by row due to the For Each Excel or CSV step, while the Set Values in Row step maps each CSV row's data into its own Excel row. This example maps only two columns of data for each row, but if a user wishes to transfer more columns of data, then select the Set Values in the Row step, locate "New Values" under Inputs, and then click Add. A new item will appear below. Change that item's input mapping to Select From Flow, then map it to the next appropriate field in the current row. For example, "Current Row.Field03.TextValue" reads the CSV's third column of data, etc. Once this loop finishes, the Update File with Data step saves all the data taken from the CSV into the Excel file. Finally, the end step outputs the result of the Update File with Data step for the Form located in the Parent Flow. The generated Excel file may be downloaded from this Form.