Read specific columns from excel by column name

Hello, I have a rather large excel file (8.5k rows and 30 columns) that I need to read data from. However, I only need the data from 5 columns in the excel sheet, these 5 columns are not consecutive. I cannot edit this excel file in any way as it is used by another part of the process. As you can imagine reading the entire sheet takes quite a bit of time so I would like to avoid this. Is it possible to only read the 5 columns I need from this sheet and ignore all others? Would this speed up the process of reading the sheet?

Hi @Jacob_Orkis1

You can use the following query in assign activity:

yourDT.DefaultView.ToTable(False, "Column1Name”,“Column2Name”,“Column3Name”,“Column4Name”,“Column5Name”)

As per your requirement, this will take 5 specified columns.

Hope this helps,
Best Regards.

Hi @Jacob_Orkis1

You can use Filter Datatable activity to keep only the column names.

While reading from excel try switching between Workbook Read Range and Excel Read Range to see which works faster.

Hope this helps

@Jacob_Orkis1

Try workbook activities or try changing settings on excel process scope…

Alternately you can use read column activity…and then can merge the columns data into single datatable

Cheers

Hi @Jacob_Orkis1 ,

Please check this below workflow attached,
Uipath_ReadRequiredColumns.xaml (12.9 KB)

Files Used:-
Sample.xlsx (676.8 KB)
DeleteSheet.txt (92 Bytes)
Copy_Specific_Columns.txt (524 Bytes)

Hope this might help you :slight_smile:

Hi @Jacob_Orkis1
First for reading excel you can use “Workbook Read range” activity. then you can apply filter on column names.

Sharing 4 ways to filter Data Table. Please see the link below-