How can I copy the whole excel workbook?

Hi,

I have a “Template.xlsx” excel workbook with the right layout and formatting. I also have another workbook with all the workers data. I need to make an excel workbook for each person witht heir own data using the Template’s layout.

So my idea was to copy a template per person, fill it and save it with changing the name to a persons id. So that I’d have a folder with a bunch of workbooks for each person and the original Template.xlsx file should still be empty.

I can only find how to copy an excel sheet though, not the whole workbook.

Is it possible at all?

Hi @Sasha_R can u share samples excel files including the template?

Here’s what the template looks like:

And the workers’ data:

For each worker u need to create a template as that of template excel file? @Sasha_R

Well, I need to fill that template for each worker and save it as a separate xlsx with the persnr (worker id) as a file name.

Hi @Sasha_R
I think template and worker excel file had same headers

so if it is true
Try this way

  1. Read the excel file having workers data and store in dt1
  2. use for each row to loop through each row of dt1
    inside the for each row do the following
    use assign activity to assign like this
    dt2 = dt1.Clone() where dt2 is the datatable which contains headers of dt1
    use add datarow to each row to the dt2 datatable

Then after use use write range with excel file name as row(“Persnr”).ToString+".xlsx"
and datatable dt2 into the write range

Check this workflow for reference
I had done a simmilar scenario
sample_12.zip (2.9 MB)

Mark it as solution if you got it

Regards

Nived N

Happy Automation