Loop through every seven rows in Excel, copy and paste


I have a process where I need to read data from column A (all rows until empty) and paste it into a search field. Problem is, I need to copy values from seven cells at a time paste another place and loop this until there is no more data in the column. I have tried with for each and assign activities but it doesn’t work. I keep getting a lot of type conversion errors for example from char to string or datatable to datarow, datatable to ienumerable. I have an idea that there must be a better way to do this than to use so many type conversions that don’t work.

If there is no other way to do it, I would love help with the current error that is “type Char to type string not possible”

Here is my current workflow: main_example.xaml (19.9 KB)

Thank you!


You are reading columnA and pasting it into a search field. After that how it is related to the seven cells… is it connected with the search result. Where you are searching, that means your search field.

I want to be reading each cell in column A (A1, A2, A3) and I to read seven of these at a time so A1-A7 for first loop, A8 to A14 second loop and so on. I want it to copy those seven cells and paste into only one search field, no need to be formatting between the values or anything, just pasted as one long string basically.

I hope this makes sense, thanks for taking time to help me

After you have your datatable, dont use a for each row activity, just consume your data like this:
After you used your seven rows, just remove them using Remove Data Row passing the indexes 0 to 6, repeat until your rows are done…

1 Like

Thank you so much for your solution, I will try it, but will it work if I have an unknown amount of rows? Also, the amount will typically be over 2000, that might be a long sequence to have?

The idea is that you try this inside a while loop, and increment a integer variable as the last index until is all rows processed…