Write String variable value to an Google Sheet cell with Incremental feature

Hi, I created an automation script using “For each Row in spreadsheet” activity. Inside it, I placed browser activity > Type into > Extract table data > Assign > Write cell (Google sheet).
There’s a google sheet with some store names, each name typed in google and scrape search results into a data table. Then using the Assign activity. I get the index of a specific company name and assign the index number to a string variable.

position = (ExtractDataTable.AsEnumerable().ToList().FindIndex(Function(row) row.Field(Of String)(0) = “STORE_NAME”) + 1).ToString()

I use a “write cell” activity to write the index number back to the spreadsheet. The issue with the current flow is that the “position” value get replaced in cell B2 each time.

image

I need to use an incremental way to write the “position” value. (eg. iteration 1 write to B2, Iteration 2 write to B3… etc)

Hi @ramitha138

You can try this way,

Assign an integer variable with a value of 1 outside the ‘for each’ loop. Inside the loop, increment this variable. Then use this variable in the ‘write cell’ action.”

image

Regards,
Gowtham K