How to get data from excel, and auto increase

Hi all,


I am trying to get the number in column E, and then for subsequent future data, it will automatically increase. Right now Row 26 and 27 are for 1 record, so if another record is added in the future, the number in Column E for the new record should be 2.

How would I go about this issue? Thanks

Hi @SRoyi

1.Read Range Excel
2.For each row in data table
3. Assign: ColumnName=CurrentRow(“ColumnName”).ToString

Hey @SRoyi ,
Use write cell activity, it as an auo incremenent row option
image

image

Hope it helps you

@SRoyi

  1. Read the Excel File

    • Use Excel Application Scope to read the file
    • Use Read Range to get data into DataTable (dtData)
  2. Find the Last Row Number in Column E

    • Use Assign activity: lastRow = dtData.Rows.Count
  3. Increment the Number for the New Record

    • Use Assign activity: newNumber = lastRow + 1
  4. Write the Updated Data to Excel

    • Use Assign activity: dtData.Rows(newNumber - 1)(“ColumnE”) = newNumber
  5. Save the Excel File

    • Use Excel Application Scope to save the DataTable back to the file

Hi @SRoyi
To increment the value in column E if column F has a value, we can use the following formula in cell E2:

=IF(F2<>"",IF(E1="",1,E1+1),"")

This formula checks if cell F2 is non-empty then:

  • If cell E1 is empty, set the value to 1
  • Otherwise, take the value of cell E1 plus 1

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.