How to add an excel workbook sheet

I have a bot that take invoice information (name, id, amount, etc) and populates an excel sheet for that given run/day. This bot is ran once a day, almost everyday.

My question is - instead of having the bot append all the entries after the last filled row in the same sheet each time, can I have the bot create a new sheet for the given day in the same workbook and just start from row 2 (after headers) each time?

Hi @chris.bartkewicz

yes, you can use write range activity and specify the name of the new sheet.

or you can consider creating your sheet as date for e.g. 28042025 for today’s date. that way everytime, new sheet will be created for new day.

You can use below expression in sheet name property:
DateTime.Now.ToString(“ddMMyyyy”)

Hope this helps.

Regards
Sonali

1 Like

@chris.bartkewicz

You can use write range by default if the sheet or file does not exist it would create..if already present then it would write in that

Cheers

Hi @chris.bartkewicz

If your data looks like:

Date, Name, Id, Amount
28-Apr, A, 1, 10
28-Apr, B, 2, 20
29-Apr, C, 3, 30

You need to:

  • Extract the distinct values from the “Date” column into a list.
  • Loop through this distinct date list.
  • For each date, filter the original DataTable to get rows matching that date.
  • Use the Write Range activity to write each filtered set to a separate sheet and set the sheet name with current list item.

Hey @chris.bartkewicz when you are write your data everyday when the bot run you can use datetime method so evertime bot run it will create a new sheet everyday which better for you as well to check the sheet data as well. as also enable the Header option so bot is write from 2.

cheers

it’s helpful.

Thanks.

1 Like

Hi @chris.bartkewicz

I understand this issue is now resolved per our discussion in another topic for similar issue.

Kindly mark solution so this topic can also be closed and help others.

Regards
Sonali