How to use "Find First/Last Data Row" action to set Excel cell reference

I am new to UiPath StudioX and working on a POC for my team. I’ve successfully gotten most of the process to work correctly; however, I’m having an issue updating the last active row in an Excel file to record a log record.

Is it possible to use the “Find First/Last Data Row” action to create an expression to use the last row number for the “Where to write” field for the “Write Cell” action?

There might be an easier way to complete the task, but I’m using the “Find First/Last Data Row” action
to save the last row number to a variable titled “LastRow.”

Next, I am using the “Write Cell” action to update the log record in Excel, but have it as a static row reference, i.e., MyExcelFIle.Sheet(“LogNumbers”).Cell(“D1443”). What I would like to do is enter an expression like MyExcelFIle.Sheet(“LogNumbers”).Cell(“D” & LastRow &" )" so the row number updates each time the robot runs.

Thanks in advance for your help.

Read Range Excel Sheet > myDataTable

myLastRowIndex [int32] = (myDatatable.Rows.Count - 1) is the index of your last Row.

Now in Excel If you have a header just add + 2 : WriteCell : “D” + (myLastRowIndex+2).ToStrnig

You can leave out the -1 and write only +1 instead. I wrote it out to keep the index-integrity.

1 Like

@murphyhd - Have you find solution to your problem? if not, please refer this post…