Previously I asked for help with getting 20 items in an excel column at a time and copy them to somewhere else.
Someone was kind enough to provide me with this process.
However, now I would like to understand what the expression and the command in the “Repeat number of times” means, can anyone kindly explain it?
If I were to use this in the future with for example, 50 items instead, what would I need to change with it?
First, we get last row number using FindFirst/Last DataRow activity.
Next, calculate number of chunks using the following expression.
last \ 20 -Cint(last mod 20 <>0)
If number of rows is just multiple of 20 such as 40 etc., Cint(last mod 20 <> 0) returns 0, and result will be 2
If number of rows is not multiple of 20 such as 42 etc., Cint(last mod 20 <> 0) returns 0, and result will be 3
Then repeat number of chunks.
As index of data row (except header ) starts 2, start address of chunk can be expressed "A"+(CurrentItem*20+2).ToString
And end address of chunk can be expressed "A"+(CurrentItem*20+21).ToString
If you need to change chunk size from 20 to 50, expression will be as the following.
How can I make this apply to filtered excel file then?
When testing, if the first filtered item is outside the range of the chunk, for example item is on row 24, so when filtered, it is still labeled as row 24, but the bot currently grabs in groups of 20, so the bot will think there isn’t any item, therefore bailing the process.
As the above approach is row index based, it’s difficult to consider filtered rows.
If you need to ignore filtered rows, can you try the following datatable based approach?
We can probably set string from datatable to clipboard.