Insert an index column in excel

How do you insert a column into excel with incremental numbers? I’ve tried using loops and write cell to accomplish this but the speed is very slow as it takes about 2-3 seconds to write one cell. This isn’t good because the excel file I am working with has more than 7k rows. Is there a way to make this faster such as creating a column beforehand and inserting that whole column into the excel file? Also, the rows are not fixed and may change if I am using a different file. So far, I can count the total number of rows but do not know how to create a column and insert that into the excel file.Thanks.

@anon5199880 First read excel and count the number of rows in it, then create new datatable with column, Using loop add the values till counter reaches the no of rows in excel and atlast write that datatable to excel

So the flow would look like this?
Build Data Table → Add Data Row inside a loop until it reaches the number of rows?

Thanks I got it to work, I just needed to set the auto increment option in the build data table activity and then let the loop run after.

1 Like

@anon5199880 Nice bro :grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.