Use Filter Table/linq and pick data if column 12 is empty after you have read the datatable. Also, to address duplicate records use this after you read dt
Dt = dt.defaulview.ToTable(True,"Column Name)
In Set transaction update the column 12 once its successful.
In this way whenever you run next time, after reading the datatable and using filter datatable , you will pick only unprocessed rows i.e only when column 12 is empty.
We don’t have duplicate rows, I just want to avoid creating duplicates by writing the date in column 12, so in the case it fails, then UiPath knows which row was last processed.
@zuby_x you can dt.AsEnumerable().Where(Function(row) String.IsNullOrEmpty(row(“YourColumnName”).ToString)).LastOrDefault() to find last empty row in a column and you can use write cell using index value from above linq to write at specific cell.
When you filter for records as per column 12, the processed records will not be in datatable only, so the chances of duplicates aren’t their.
Provide column12 name here, based on it you can take two approcaches , 1. to keep column12 which is empty. or 2. Remove column12 data where column12 is not empty and proceed accordingly.
We currently have ~4000 rows (and it grows by 20–30 rows/day). I tried a similar approach, but in our file each day is separated by a “divider” row (blank row), where only column A has the date. So I needed to skip those divider rows and only process the actual data rows where columns 1–11 have values.
This is what I ended up checking for a “real” row to process:
If condition inside loop to check if column value is empty String.IsNullOrEmpty(currentRow("Column12Name").ToString.Trim)
This way its more clean
if you want to use more standard way then you can use REF…in the init state read the data into datatable and then add new column which should contain the row number…Basically after reading loop through the data and add currentindex+1 as calue for new column(as its datatable would not take much time). Now filter Datatable with empty values in column 12 uding filter datatable…and now the new filtered datatable is the io_transactiondata variable which will loop each row..and the new row number column add will help in updating the data to excel as it would be the row number in excel