Looping Through An Excel Spreadsheet (For Each Row)

uiautomation

#1

I am trying to loop thorough and Excel, the process infromation as followings:

  1. Open an Excel file and pull the data from cell C3, this data will be used to open a subsequent Excel (CSV) file. i.e. the data in cell C3 is the name of the Excel (CSV) file that needs to be opened
  2. Once that Excel (CSV) file is opened, use the data in E3 to filter the data in the Excel (CSV) file
  3. Take that filtered data and write it into a new Excel file

Repeat these steps, except data will be pulled from C4 and E4 respectively, C5 and E5, C6 and E6…such on and so forth.

I need this to occur until the end of the column is reached

Thank you for your help


#2

Hey,

What have you tried so far?

To do the data grabbing I would simply use a counter.

So something like:
Assign - counter = 3 (for E3)

In your read excel range i would put “E”+counter

At the end of your for interaction I would put assign - counter = counter + 1

For the rest:
For filtering, take a look here: https://activities.uipath.com/docs/excel-filter-table

You need to have your excel range you want to filter named as a table:
image

After you’ve filtered simply write to a new CSV file.

How I would do it:

  1. I would open your excel file using the “E”+counter above
  2. Read the whole CSV file into a datatable
  3. Use ‘Filter Data Table’ activity (SUPER EASY!! I LOVE THIS FEATURE)
  4. Write to CSV
  5. assign counter + 1 and repeat