<img src="//trc.taboola.com/1222697/log/3/unip?en=page_view" width="0" height="0" style="display:none">


The Knowledgebase articles are deprecated. Please visit the new Guides and Resources here: https://www.uipath.com/developers/guides-and-resources.

Knowledge Base

How to extract Column Headers in a CSV file

The Read CSV File activity extracts data from a CSV file using a dataTable format. The first line in the CSV file is automatically considered as the column header. The first line is usually not included during the extraction.

However, if you wanted to include the column headers, follow these simple steps:


1. Start with the Read CSV File Activity. Specify the path of the CSV File.

2. Add a For Each Activity to scrape the items in each column in this sequence: For each column in dataTableReadCsvFile4.Columns

The dataTableReadCsvFile4 is the dataTable where the extracted data is stored from the test.csv file. This can be found in the Output section of the of the test.csv file.

3. Add the Write line activity to print the results column.ColumnName. You can also use this output in other activities or actions.