Excel - Previous run report is overwritten with new run report

I have created an excel file where i write the run report of robot (each time) my process is completed with mejor task plus when robot started and when ended. (As i have no connceted to any database yet).
It works perfect in first time but issue is when i run the robot 2 time means again and again it overwrite the previous history.

I just want that It wont delete the previous histpry and start with new rows when i run the robot again so that i have a history to look back.
I write to excel like that…

Rang on write cell is: ColumnLeter (A) + currentIndex is (current row +1)
strColLetterStartTime+ (iot_intCurrentIndex).ToString()

but why its overwriting… kindly help


You could certainly debug this and successfully manage to get this working.
Although may I suggest a much simpler way to achieve this?

Please use Append Range activity which will automatically find the next empty row and append your easily managed datatable in one go.

Additionally, if it’s not critically important to update your excel file consistently, you might consider just maintaining a datatable and write the entire table at the end of the process. This, f course, won’t apply if you need the file to be consistently updated.
A scenario comes to mind where someone else is tracking the progress by checking the file from a shared location, etc. (which still might be tricky as the bot will continuously update the file)

I hope that helps make your program simpler.

I appericate your answer…
I did deburg but it’s giving same issue.

Reason I want to write each time… it’s an RDA which several computer will run it means several people will start this robot and I need to track where robot is stop on which process with errorcode and error status.
I can not use datatable as I devided code in files så that its easy to tract an error.

Regardless of the shared nature of the machine, your first problem can still be solved by using Append Range. First issue, that is, finding the next empty row and writing to it.
Follow this approach:
Within Excel Application Scope (which you’re already using by the way, so kudos!)

  1. Activity → Build Data Table
    Define Columns → Start Time, Error Code, Status, End Time
    This will give you a new blank datatable with the 4 desired columns.
  2. In your flow, define and assign four corresponding variables to these columns. This gives you the freedom to update them wherever you want in the flow.
  3. At the end, use
    Activity → Add Data Row
    Use the input → ArrayRow and pass the following array.
    { startTime, errorCode, status, endTime }
    This will give you a datatable with just one row.
  4. Use activity → Append Range
    Pass this single-row datatable to the spreadsheet.

Rinse and repeat.
Please ask if there are any questions.

Thanks for the help
I came to manage the other way by "counting the Table Row and than added 1 means plus 1 into that counting.
It’s not overwriting the data anymore.

1 Like