I was recently working on string manipulations in Power Automate, where we wanted to replace apostrophes with double quotes. You can do it easily.
In this tutorial, I will show you how to replace an apostrophe character in a string in Power Automate. Additionally, I will cover the following examples.
- Replace the apostrophe mark in a Power Automate string variable
- Replace the apostrophe with a blank value using Power Automate
- Replace a single apostrophe with a double apostrophe in Power Automate
Replace Apostrophe in String Variable in Power Automate
Suppose you have a string variable that stores a country value within apostrophes that can be used during the flow execution. Example: ‘United States of America’
Now, you want to replace it with double quotes, like “United States of America”.
You can do this by using the steps below in Power Automate.
- Create an Instant cloud flow in Power Automate that can be triggered manually by clicking a button.
- To store the string value, add an “Initialize variable” action and set the parameters, such as Name, Type, and Value.

- Next, add a “Compose” action to replace the apostrophe present in a string variable. Provide the below expression in the Inputs section.
replace(variables('VarCountryName'),'''','"')
- Now, the flow is ready to save and test. Click on the Save button -> then the Test icon. In the Test flow pane, select Manually and click on Test.

- Once the flow runs successfully, you can see that the apostrophe present in a string variable is replaced with double quotes.

Now, let’s have a look at another example that will replace the apostrophe with the blank value using Power Automate.
Check out How to Update SharePoint List Items from Excel using Power Automate?
Replace Apostrophe with Blank using Power Automate
Suppose I consider a URL of a SharePoint document library file, i.e., with an apostrophe symbol, like the one below. But that is not correct. Now, I wanted to replace the apostrophe with a blank value to browse it correctly.
'https://your tenant.sharepoint.com/sites/HR/HRDocuments/Policy.docxHere, I will also create a Power Automate Instant cloud flow.
See the steps below:
- To the Power Automate flow canvas, add a “Compose” action to store the URL of a SharePoint document library file.

- Now, add another “Compose” action to replace the apostrophe with a blank value. Insert the code below in the Inputs parameter.
replace(outputs('Compose_-_Policy_Document'),'''','')
Save and test the flow manually.
Output:

This way, you can replace an apostrophe with a blank value in Power Automate.
Replace Single Apostrophe with Double Apostrophe in Power Automate
This is an interesting example, and I’m sure you’ll love it.
Many times, you may need to replace a single apostrophe with a double apostrophe in Power Automate.
Here is an example.
As you can see, below is a Project Information List, where each project has different clients. To filter SharePoint list items by client name in Power Automate, we can use the filter query in the Get Items action.
However, the filter query will work correctly for all items, except for the list items that contain a client name with an apostrophe mark (In this case, it is D’Souza).

The filter query will return an error if the client’s name has an Apostrophe mark [Single quotation mark].
ProjectClient eq 'D'Souza' - Returns errorThe reason for the error is that the query searches for the text within the single quotes. So the search actually would be looking for ‘D’ and then it doesn’t know what to do with the 2nd part of the string ‘Souza’, so it fails.

To avoid this error, we need to replace the apostrophe with a double apostrophe, so that it will not generate the error.
Follow the steps below:
- Create a Power Automate Instant cloud flow.
- After that, add an ‘Initialize variable‘ flow action. Here, I will use the value as the client’s name that I want to filter inside the filter query.

- Then, add a ‘Get items‘ action that will filter the SharePoint list items based on the client’s name. Provide the Site Address and List Name.
- Filter Query: Insert the expression below.
ProjectClient eq '@{replace(variables('Client Name'),'''','''''')}'Note:
To replace the single quote (Apostrophe ) in a string, you need to use two single quotes in the replace expression. Here, we are replacing with 2 single quotes, then we need to place 4 single quotes inside the replace() expression wrapped with another two single quotes. Then, total it will be 6.

- Now, save and run the flow. The flow doesn’t generate any error, and it will fetch the item that matches the filter query.

This is how to replace a single apostrophe with a double apostrophe in Power Automate.
I hope you now understand how to replace an apostrophe in a string using Power Automate with various examples.
I hope this article was helpful. If you have any thoughts or suggestions, mention them in the comment section.
You may like the following tutorials:
- Convert String to GUID Power Automate
- Power Automate Generate Serial Number
- Replace Space in SharePoint Calculated Column
- Replace Commas with New Lines Power Automate
- How to Filter an Array by String Values in Power Automate?

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.