Select Column Based on String

I’m trying to select an excel column based on a string. However, that string is not at the top of the file so the “column name” function didn’t work. Please let me know how I should approach this. I want to pull the entire column following a particular string.

@scott.luntz

One approach is :-

You can use lookup range, your input will be a search string.
Output will be a range like A1 or B3 or some other range.
Based on that, you can get column index and column number.

Other is : -

To use a for each row and loop through all columns and rows, create one flag and set it to true when you find that particular string.

2 Likes

@scott.luntz Welcome to our Uipath Community.
The most suitable approach here is to use Lookup Range, here you can specify particular row and column range where you want to search your string.

Note: It doesn’t work if column is hidden or not visible in general

Hi @scott.luntz

Welcome to UiPath Community !

Here is an activity called “Find”. It will return the cell info and row index. based on the cell info you can select the column.

Video :

Thank you
Balamurugan.S

That worked however now I would like to select multiple columns. So far I have a lookup activity which stores the cell of the string and then goes to the read column and adds each row to a data table with a for loop. How can I select multiple columns?

That worked however now I would like to select multiple columns. So far I have a lookup activity which stores the cell of the string and then goes to the read column and adds each row to a data table with a for loop. Now I would like to select multiple columns and write them to a CSV. How can I do that?

Hi @scott.luntz,

  • Use copy to clipboard activity to copy the columns with range “A:D” .
  • use paste to clipboard activity to past the another excel file or sheet.
  • Read the excel file and write into the csv file.

Regards
Balamurugan.S

How can I merge 2 data tables side by side if they don’t have anything in common to join them?