When using Excel to create invoices

Hi everyone.
I am doing a project where I am using Excel files to make individual invoices for different customers. I have already applied Excel Application Scope, Read Range, For Each, and Assign successfully. The next step is to use Copy File, where I use an Excel templet (MasterInvoice) to create individual invoices for each customer. Below is a screenshot of the errors I got when running. What am I doing wrong, and how can I fix it? Best regards, Hallgrímur

Hi @Hallgrimur_Ingolfsson_HI

In the copy file To section you need to use the variable invoice number right. Use it like this.

“MasterInvoice” + InvoiceNumber + “.xlsx”

Also check the scope of the invoice number i think it is not accessible in your copy activity.

Hope this helps :slight_smile:

Hello @Hallgrimur_Ingolfsson_HI

Sequence
Excel Application Scope (Read Range, For Each, Assign, etc.)
Assign: sourceFilePath = “C:\Path\To\MasterInvoice.xlsx”
Assign: destinationFolder = "C:\Path\To\Invoices"
Assign: customerName = “DynamicCustomerName” // Replace with your logic to get customer name

Try
 Copy File
     Source: sourceFilePath
     Destination: destinationFolder + "Invoice_" + customerName + ".xlsx"

 Catch (System.Exception)
     Log Message
     Message: "Error copying file: " + exception.Message

 Finally
     Log Message
     Message: "File copy process completed."

Thanks & Cheers!!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.