In this Power Automate tutorial, we will see how to fix the error ‘A file with the same name is currently being saved to this site‘.
Recently, when creating a Power Automate flow to generate a Word document in the SharePoint library based on the SharePoint list, I encountered an error stating that A file with the same name is currently being saved to this site.
In this tutorial, we will discuss why we encounter this error ‘A file with the name already exists’ and how we can fix this error.
A file with the same name is currently being saved to this site in Power Automate
Here, we have a SharePoint list called Order Tracking, which contains all the information related to the order. Whenever a new order is added, we will create an invoice if the Payment status is paid.
The SharePoint list contains the following columns:
Column Name | Type |
---|---|
Title | A single line of text |
Customer Name | A single line of text |
Shipping Address | A single line of text |
Order Date | Date/Time |
Product Ordered | Choice [Laptop, Pendrive, Headphone] |
Quantity | Number |
Total Amount | Number |
Payment Status | Choice [Paid, Unpaid, Declined] |
Invoice Number | Single line of text |
Payment With | Chouce [UPI, Cash, Card] |
Payment Date | Date/Time |
Invoice | Attachment |
To create the invoice, we created an Invoice template containing properties. We will populate this Word document in the flow to add value to those properties. Once we add the properties, we will create a Word file in the SharePoint library.
After that, we convert the Word file to a PDF file and add it to the SharePoint list as an attachment.
Below, you can see the Invoice template:
For the execution of the task in Power Automate, first, I have added a trigger action i.e. ‘When an item is created or modified’ to the flow. Then, provide the site address and list name.
Then we check the payment status is paid; for this, I have added the condition action to the flow, like below.
If the Condition is true, then we will populate the word template and map the value to the properties like below.
Next, we will create a file in the SharePoint library, for I have added a Create file action and provided the information below.
Then I convert the Word file to pdf using the Encodian action, i.e., Convert to pdf and provide the information like below.
In the last step, I have added the attachment to the SharePoint list; for this, I have added the ‘Add attachment’ action and provided the information below.
Now the flow is ready, and I run the flow manually and create an item in the SharePoint list.
You can see the below image. flow run failed, and I encountered the error: A file with the same name is currently being saved to this site
In the next part, we will see how we can fix this error in Power Automate.
Solution: A file with the same name is currently being saved to this site error in Power Automate.
Let’s first understand why we get this error: ‘A file with the same name is currently being saved to this site’ in Power Automate.
Now, if you look at the Create file action image, here I am providing the file name as ‘Invoice Invoice Number.docx.
As it clearly stated:
- The invoice is normal text
- Then Invoice number is selected from dynamic content.
- In last, we are providing the extension as .docx.
When we run the flow, the file name is coming as Invoice #009.docx. As in SharePoint, we can’t use the special characters in the file or folder name, so we need to replace these characters for creating the file in the SharePoint library.
I have used the expression below to remove the special character ‘#’ from the file name. So it replaces the ‘#’ with ”.
replace(triggerOutputs()?['body/InvoiceNumber'], '#', '')
Now, if I run my flow, my flow runs successfully without any error.
This is how we can fix the error ‘A file with the same name is currently being saved to this site’ in Power Automate.
Conclusion
In this Power Automate tutorial, we saw how to fix the error “A file with the name already exists in Power Automate”.
You may like the following tutorials:
- The DateTime String must match ISO 8601 format error in Power Automate
- Argument ‘Body’ must be ‘Binary’ – Power Automate Desktop error
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com