Power Automate conversion of string

This Microsoft Power Automate tutorial will learn how to convert a string to various data types on Power Automate or Microsoft flow. And these topics are:

  • Power Automate convert string to integer
  • Power Automate convert string to currency
  • Power Automate convert string to Date
  • Power Automate convert array to string
  • Power Automate convert string to Guid
  • Power Automate convert string to JSON Object
  • Power Automate convert string to Array
  • Power Automate convert string to float

Power Automate convert string to integer

Here we will see how to convert a string to an integer and also we will calculate the sum of these integers on Power Automate. For this, we have to follow this step-by-step guide.

Step-1:

On Power Automate, we will start by triggering the flow manually by adding “Manually trigger a flow” from Instant cloud flow. Also, we will add two user inputs as Text like below:

Power Automate convert string to integer
Power Automate convert string to integer

Step-2:

In the next step, we will add a Compose action that will convert the text or string input to an integer. For this, we will use an expression using int().

int(triggerBody()['text'])

(Here we took the text i.e. text1 from dynamic content)

convert string to integer Power Automate
convert string to integer Power Automate

Step-3:

Similarly, we will add again a Compose action, that will convert the input( on text2 ) to an integer using the int() expression.

int(triggerBody()['text_1'])  

(Here we are using the input from text2)

Microsoft Flow convert string to integer
Microsoft Flow convert string to integer

Step-4:

Now our flow is ready. When we will run, it will ask to insert two inputs as text1 and text 2. After successfully run we can see it converts the string(inputs) into an integer.

Microsoft Flow convert string into integer
Microsoft Flow convert the string into an integer
Microsoft Flow convert string into integer
Microsoft Flow convert the string into an integer

Step-5:

Now we want to add these integers on Power Automate. For this, we will add again a Compose action and insert the below expression.

add(outputs('Compose'),outputs('Compose_2'))
Convert a string to integer on Power Automate
Convert a string to integer on Power Automate

Similarly, when we enter two string values it will convert these into integers and calculate their addition. Here we are going to take the same values i.e. 50 & 35.

Power Automate convert string into integer
Power Automate convert string into an integer

This is how to do Power Automate convert string into an integer. You can download this flow from here.

Also read, Power Automate Number Format

Power Automate convert string to currency

Now, we will discuss how to convert a string into currency in an automated flow or Microsoft flow. To solve this, here we have provided a step-by-step guide. Please have a look at these below steps.

Step-1:

First, we will trigger our flow manually. For this, on Power Automate, click on “Create” then select “Instant cloud flow” and click on “Manually trigger flow“.

Power Automate convert string to currency
Power Automate convert string to currency

After clicking on Create, we can see our flow is triggered manually.

Step-2:

Now we will add the action “Initialize variable” to initialize a variable and set the type as “String” on the flow. Also, insert a value that you want to convert into a currency data type.

Power Automate flow convert string to currency
Power Automate flow convert string to currency

Step-3:

Then we will add a Compose action that will convert the string value into an integer. Insert the below formula in the expression bar as inputs.

int(variables('VarString'))
convert string to currency in Microsoft flow
convert string to currency in Microsoft flow

Step-4:

Then again we will add another action “Format number” to format the output of the compose into currency.

convert string to currency Power Automate
convert string to currency Power Automate

Now our flow is ready. To test it, first, we have to Save and click on the Manually. Here is the result.

convert string to a currency in Microsoft flow
convert string to a currency in Microsoft flow

This is how we can convert a string to a currency in Microsoft flow.

You can download this flow from here. We hope it might help you.

Read Power Automate Initialize Variable

Power Automate Convert String to Date

Now, we will discuss how to convert a string into a Date in Power Automate or Microsoft Flow.

This is one of the day-to-day requirements of conversion from string to date. For example, we have a date input string such as 22,10,2021. We can see in that date the day, month and year are separated with a comma. But we want to convert this string input in a date format i.e. 22 October 2021.

Step-1:

In Power Automate, we will start from trigger the flow manually. We can add this from Instant cloud flow.

Step-2:

Then we will add an action as Initialize variable. Here we will set a date as string input like below:

Convert string to date PowerAutomate Flow
Convert string to date Power Automate Flow

Step-3:

Again, we will add the same action as Initialize variable that will convert the date string into an array and split the day-month-year with a comma by using the Split() expression. As the date string(22,10,2021) is not understood by Power Automate so we need to add this step.

split(variables('VarDateInString'), ',')
Power Automate Convert String to Date
Power Automate Convert String to Date

Step-4:

In this step, we will convert this array to our desired date format. For this, we will add the same action as “initialize the variable“. In this action, we will insert an expression that will format the array in Date. The expression is:

formatDateTime(concat(variables('VarDate')[2], '-', variables('VarDate')[1], '-', variables('VarDate')[0]), 'dd MMMM yyyy')
Microsoft Flow Convert string to Date
Microsoft Flow Convert string to Date

Here we set the date format as “dd MMMM YYYY” so it will return with the full month name i.e. 22 October 2021. Let’s check this output by saving and testing the flow.

Power Automate Convert a String to Date
Power Automate Convert a String to Date

Similarly, if we insert the date format as ” dd MMM YYYY ” then the month will return with a sort name such as 22 Oct 2021.

Microsoft Flow Convert string into Date
Microsoft Flow Convert string into Date

This is how we can convert a string into a Date in Power Automate. You can download this final flow from here.

Also read, Power Automate convert time zone

Power Automate convert array to string

Here, we will see how to convert an array to a string in Power Automate or Microsoft flow.

For example, we have some cities’s names in an array format. Such as:

[ "New York","Chicago", "Texas", "California"]

But, we want this array in a string format on Power Automate. So for this, Let’s have a look at the below steps.

Step-1:

In Power Automate, first, we will add “Manually trigger a flow” from “instant cloud flow“.

Step-2:

After adding this, we will add the action “Join” under the “Compose” action.

Power Automate convert array to string
Power Automate convert array to string

This Join has 2 parameters. One is From where we insert an array, and another one is Join with where we need to convert it to a string separated by a comma.

Convert an array to String in Power Automate
Convert an array to String in Power Automate

Now just Save the flow and Run it. In the output, we can see the array is converted into a string like below:

Power Automate convert array into string
Power Automate convert the array into a string

This is how we can convert an array into a string in Power Automate. You can download this flow from here.

Also read, Power Automate Concatenate String

Power Automate convert string to Guid

Guid stands for Globally Unique Identifier. Now we will see how to convert a string into Guid format on Power Automate.

First, we need to trigger the flow manually to implement this. Then we will initialize a variable by using a string guid. For example, we have a guid string “f0e4273f10c14551a494977ebeb5b5fa“.

Power Automate convert string to Guid
Power Automate convert string to Guid

Again we will add the “Initialize variable” action. On the value section, we will add an expression that will convert the string into guide format without braces. The expression is:

concat(substring(variables('VarGuid'),0,8),'-',substring(variables('VarGuid'),8,4),'-',substring(variables('VarGuid'),12,4),'-',substring(variables('VarGuid'),16,4),'-',substring(variables('VarGuid'),20,12),'')
Power Automate convert string to Guid format
Power Automate convert string to Guid format

Similarly, we will add another “Initialize variable“, where we will insert an expression that will convert the string into guid format with curly braces. For this, the expression is:

concat('{',concat(substring(variables('VarGuid'),0,8),'-',substring(variables('VarGuid'),8,4),'-',substring(variables('VarGuid'),12,4),'-',substring(variables('VarGuid'),16,4),'-',substring(variables('VarGuid'),20,12),''),'}')
convert string to Guid Power Automate
convert string to Guid Power Automate

Now the flow is ready. We can see the result by saving and testing it.

How to convert string to GUID in power Automate
How to convert string to GUID in power Automate

This is how we can convert a string to GUID format on Power Automate.

There is another way to create GUID dynamically on Power Automate. For this, Microsoft Flow provides a function “guid()“. It used to return a new GUID in a string format but it does not create a GUID based on the string format that we provided.

Now we will see how to create a GUID using guid() on Power Automate. For this, here we will take a Compose action

Power Automate Guid function
Power Automate Guid function

Let’s run the flow to check the New Guid on the output.

Guid function on Microsoft Flow
Guid function on Microsoft Flow

This is how we can create a Guid using guid() on Power Automate. You can download this total flow from here.

Also read, Leave Request Approval Flow using Power Automate or Microsoft Flow

Power Automate convert string to Array

In this section, we will see how to convert a simple string into an array in Power Automate. There is a function that will convert the input into an array.

For example, we have a string i.e. California, Florida, Texas, Arizona, Washington, New York.

Now we will use this string as a variable by initializing on Power Automate:

Power Automate convert string to Array
Power Automate convert string to Array

To convert this to an array, we will use an expression on Compose action.

array(variables('VarArray'))
convert string to Array on Microsoft Flow
convert string to Array on Microsoft Flow

Now just save the flow and test it. We can see the output coming as an Array format like below:

Power Automate convert string to Array Format
Power Automate convert string to Array Format

This is how to convert string to Array Format on Power Automate.

Also read, How to convert decimal to whole number in Power Automate + convert decimal to percentage

Power Automate Convert String to Float

Here we will see how to convert a string(having decimal places) value to float on Power Automate. In Power Automate, there is a float function that will convert the input to float.

Let’s initialize a variable having a string value of 45.69:

Power Automate convert string to float
Power Automate convert string to float

Then we will use the float() function on a Compose action to convert the input variable to float.

float(variables('VarString'))
convert string to float on Power Automate
convert string to float on Power Automate

On the output, we see the string value is converted to float:

convert string to float on Microsoft flow
convert string to float on Microsoft flow

This is how to convert a string value to float on Microsoft flow.

Read How to move files from OneDrive to SharePoint using Power Automate

Power Automate convert string to json

Here we will see how to convert a string input into JSON format on Power Automate. For example, let’s take a string such as:

{"City":"Texas", "Name":"Alice","Number": "+1(408)7859963"}
Power Automate convert string to json
Power Automate convert string to JSON

Then we will use a Compose a to convert the string to JSON object in Power Automate. For this here we will use an expression:

json(variables('VarString'))
Power Automate convert string to Object
Power Automate convert string to Object

Now we can save the flow and test it and we can see the out put is coming as JSON object format:

Power Automate convert string to Json Object
Power Automate convert string to JSON Object

This is how to convert string to JSON Object on Power Automate.

You may like the following Power Automate tutorials:

Conclusion

From this above tutorial, we learned all about string conversion on Power Automate. Also, we discussed:

  • How to convert a string to an integer on Power Automate?
  • How to convert a string to a date format on Power Automate?
  • How to convert a string to a currency format on Microsoft flow?
  • How to convert the array into a string on Power Automate?
  • How to convert a string into GUID format on Microsoft Flow?
  • How to convert a string into an Array on Power Automate?
  • How to convert a string value into float on Power Automate?
  • How to convert a string to JSON object on Power Automate?
>