Adding new rows to a sheet and keeping old rows

Hi fellow Uipathers,

I am fairly new and getting stuck on a adding new rows to a sheet that already has rows. My flow “gets outlook mail messages” from 3 different inboxes and adds them together to output to excel. I have yet to figure out how to get each bot run to append, read range, write range the new emails to the emails already in the spreadsheet.

For example if the spreadsheet already has 50 rows and I run the bot and the 3 inboxes have 50 new emails coming in, the spreadsheet should now have 100 rows, but it still has 50 because I am overwriting them.

Any help is appreciated, thanks everyone.

Hi @srobey97

Use Append range activity instead of write range, then it append to the existing sheet

Hope it helps!!

That’s what Append Range is for. I suggest doing the free training at academy.uipath.com where there is even one specific to Excel…

Thanks pravilli, I have tried the append range, but it still overwrites the sheet.

@srobey97

Can you share the workflow so, that we might help you to solve.

I can’t because it is sensitive data, but the sequence is like this

read range->build data table->get outlook mail messages->for each mail->add data row->append range

Don’t append range for each mail. After the loop you will have a datatable with all the data - then you Append Range to write all the data.

Append Range can’t and won’t overwrite existing data. You must be doing something else incorrectly. Post screenshots of your code.

Hi Paul,

@postwick @pravallikapaluri

Any thoughts on this after seeing the sequence?

It doesn’t make any sense that Append Range would overwrite your existing data.

I noticed you’re doing a Read Range at the beginning. Are you under the impression that you should be reading the existing data from the Excel then add to it, then write back to Excel? Because that’s incorrect.

In fact, what I see now is that you have a Build Data Table after the Read Range. If both are using the same datatable, the Build is wiping out what you get from the Read Range.

But anyway, you don’t have to do any of that. All you have to do is read the emails, put them into a datatable, then Append Range to the file. You don’t have to include the existing Excel data in the datatable to append.

@postwick The reason my flow looks like that is because from another flow I did from the screenshot it works perfectly. So something must be breaking it.

Your Read Range is overwriting your datatable. You don’t need to Read Range before Append Range. You don’t load the existing data and combine it. Append Range just figures out where the last row of data is and APPENDS your new data after that in Excel.