How can I perform a write range every 100 rows instead of at the very end of my process ?
My for each row has too many rows to complete and sometime the bot fail and since my write range activity is at the very end I lose everything I want to avoid that by doing a write range every 100 rows
MasterCtr = 2.
/* Assuming you start writing at Cell A2 */
For each row
LocalCtr =0
/* Do your work here /
LocalCtr = LocalCtr + 1
If LocalCtr = 100 then
WritePos = “A”+(MasterCtr)
/ first time this would be A2 /
/ next time A102, then A202,etc /
WriteRange your stuff
/ Save next write position */
MasterCtr=MasterCtr+LocalCtr
LocalCtr=100
End if
Next
I am open to better suggestions . I just want to write in the sheet along the way to not lose everything at the end because the bot fails …
I tried to place the write rang within the ‘‘for each row’’ loop (because I dont know better) and it works but when I do that I multiply the processing time by 5
First impression. I am not sure why you need to use an Attach Window inside of an Open Browser.
The Sequence already has several levels of nesting after which the For Each commences.
Here is a generic sequence and a data workbook attached.
You set the value of X and the sequence will append the data every X rows to the output.
The Fake work done in this sequence is as follows:
Reads the 100 GUIDs in Sheet 1 into an input DataTable (this will be replaced by your actual input data)
Loops through the data table
performs fake work by reversing the GUID and converting it to upper case (this will need to be replaced with your actual work)
Adds the result to an output data table
When the output data builds up to X rows (in this case set to 10, you can change it to see different results), the data is written to Sheet2 of the excel
The first time, Write Range is used to include the headers in the output
On subsequent iterations, Append Range is used as headers are not to be appended
This process repeats within the For Each for every X Rows
You can see the output in the workbook attached and the console will look something like this: