Not jumping the row after writing the 1st one in excel, write in the same row

i want to have a excel reporting file where it writes all what the bot do, but its writing every time in the same row

I am using this code : dt_reporting. Rows.Count

i have the same sequence in different part on the try and catch, it depends if there is an exception or issue.

My problem is its writing every time in the same row

You don’t want to loop and write one row at a time. As your process runs, update the datatable and then at the end use Write Range (if a new file) or Append Range (if an existing file) to write the data to Excel.

Yes i want to loop and write a row at time, but the same file is in different part on my code, so i need to open the reporting file and use “row.count” every time to count but it doesnt work

did i need to use different count variable names (for each part) ?

why my method is not working ? If i open the same file and use row.count it suppose to count the new number of row no ?

I’m saying you don’t want to do that. Get your data ready in the datatable, then at the end just Write/Append it to Excel once.

i don’t know how to do that in many part of my process and add it in one file at the end, its easier for me to do how i showed you

Hi @Soudios

Another approch for this that may help

1-> create a CSV file using Write Text File Activity with your necessary headers
2-> alway you need to add new line, use Append Line Activity using comma to separate the information
You can use wherever you want just use the same file

3-> When you want the final excel, you can use Read CSV Activity then Write Range Workbook Activity

This way you don’t worry about Excel logic

Something like this

In the spot where you’re writing a row to Excel, update the datatable instead.

Then after all rows are processed, use Write/Append Range to dump the whole datatable to Excel.

@rikulsilva

But why it doesn’t work with my way ? it was working before what i have to adjust to let my way works.

I used “row.count” and i am familiar with this and now i don’t know why its not working

and i am not using csv file

Hi @Soudios

Probably the index you are using to update doesn’t increase for every update

The easist way to find the issue is run the process in Debug Mode going through each activity and look at Local Panel to see the current value

Using your approch will work fine, but you will have more difficult to troubleshooting when you have some issue like this because the logic to update will distribute to entire workflow.

If you update something in a specifc place maybe impact the final report result