Copy Template, Add Info from Projects, Add Multiple entries for some projects

Hello friends,

I’m trying to copy data from an excel sheet to a given excel template for a list of projects. Each of the projects in the excel file need to have a distinct report made with its own excel file. This a practice exercise where some information on the invoices is listed under the same project number, while others have just one piece of information per project number.

If all projects just had a single piece of information to copy, I would do a for each row and add it that way. Since some entries needs multiple lines and others do not, I’m having trouble thinking of a way to get the information added.

To be clear, I need to make a copy of the template for the report for each project number and add the details into the details and quantity fields. When there is a new project number, it will make another excel file from the template and add the information in the same way. I understand the ‘Copy File’ activity, I’m just having issues with figuring out how to add multiple lines of project descriptions and quantities for the same project number and then moving on to the next project.

Thanks in advance.

image
image

Hi @ZLatture , I see that in the result sheet you have the Total column as well. So, do you need to add the quantity for each of the Project # ? In that case , what will be the project description that will be present in the result sheet? (As the project description is different for each of the lines). Please confirm on the requirement. If you just need the total and can work with any of the description ( e.g. showing the first project description) , then you can do the group by using LinQ query in order to get this information.
You can check this :

try below steps

  1. read data into datatable
    image

  2. use assign activity in to field give dictionary varible of type Dictonary(string,Datatable) and value field

dt.AsEnumerable().GroupBy(Function(x) x(0).ToString()).ToDictionary(Function(g) g.Key, Function(g) g.CopytoDataTable)

here dt is datatable you have got from initial

3 use for each loop with dictionay.keys as input

Use TypeArgument as string

  1. Write Range with the sheet name as project

Along above create variable as below with proper type

Hope this helps