How to track processed Excel rows using a “Date Entered” column (resume safely after crash)

Hi everyone,

I’m looking for best-practice guidance on handling incremental processing in Excel using UiPath.

Scenario:

  • I have an Excel file with 12 columns
  • Columns 1–11 contain data and new rows are added daily
  • Column 12 is blank and named Date Entered
  • I want to write the current date into Column 12 only after a row has been successfully processed

Requirement:

Each time the automation starts:

  1. It should find the last empty cell in Column 12
  2. Start processing row by row from that point forward
  3. After each successful loop, write today’s date into Column 12 for that row

This way:

  • If the process crashes or fails, it can safely resume from the last unprocessed row
  • No duplicate processing
  • No missed rows

What I’m looking for:

  • Recommended UiPath approach (Read Range vs. Read Cell / For Each Row)
  • Best way to detect the first empty row in a specific column

If anyone has a pattern, example workflow, or best practice for this kind of “checkpointing” in Excel, I’d really appreciate it.

Thanks in advance!

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.

1 Like

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.

1 Like

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.

1 Like

Hello @zuby_x

Depending on the size of your Excel workbook, the easiest approach could just be to:

  1. Read Range Workbook → dt_ExcelData
  2. For Each Row in Data Table dt_ExcelData
  3. If Not String.IsNullOrEmpty(CurrentRow(11).ToString)Continue

Regards
Soren

Hi Soren,

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 CurrentRow.ByIndex(12).RawValue Is Nothing AndAlso _
CurrentRow.ByIndex(0).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(2).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(3).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(4).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(5).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(6).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(7).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(8).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(9).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(10).RawValue IsNot Nothing AndAlso _
CurrentRow.ByIndex(11).RawValue IsNot Nothing Then

@zuby_x

  1. Use excel file - provide the excel file path
  2. For each row in Excel
  3. 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

both approaches would work

cheers