Convert String to Integer in Power Automate

Do you want to convert string to integer in Power Automate? In this Power Automate tutorial, we will see how to convert string to integer in Power Automate.

While a string may appear numeric, it often arrives as a text string in Power Automate. This could lead to errors in subsequent steps of your workflow if you want to perform numerical operations. Therefore, it’s necessary to convert these text strings into numeric values before performing any calculations.

Here, we will cover the topics below

  • How to convert string to integer in Power Automate?
  • How to convert string to integer dynamically in Power Automate?

Convert string to integer in Power Automate?

Here, we will see how to convert a string to an integer in Power Automate.

For example, I have a number string ‘ 25’, and we need to convert it to an integer; for this, we will pass this string value in the int() function. It gets converted to an integer, and the output will be 25.

Now let’s see how we can do in Power Automate

1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.

power automate convert string to integer

Then, provide a flow name and select the “Manually trigger a flow” action. Then click on Create.

convert string to integer power automate

Now, you can see a manual trigger a flow action is added to the flow page.

Microsoft power automate convert string to integer

2. We will initialize a string variable; for this, click on +New step -> select Initialize variable action. Then provide the below information:

  • Name: Provide the name of the variable
  • Type: Provide the type as a string
  • Value: Provide the value like below
Microsoft power automate convert text to number

3. Now, we will convert the string to an integer; for this, click on the +New step -> select Compose action. Then provide the below information:

  • Inputs: Provide the below expression:
int(variables('str'))
convert string to int power automate

4. Now run the flow manually; the string is converted to an integer in Power Automate.

power automate convert text to number

This is how to convert a string to an integer in Power Automate.

How to convert string to integer dynamically in Power Automate?

Here, we will see how to convert string to integer dynamically from a SharePoint list in Power Automate.

For example, I have a SharePoint list called product, which contains 2 columns, i.e. Product name and price, both of string type.

convert string to int Microsoft power automate

We will get all the items from the SharePoint list, and we will convert the price to an integer in Power Automate.

1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.

power automate convert string to integer

Then, provide a flow name and select the “Manually trigger a flow” action. Then click on Create.

convert string to integer power automate

Now, you can see a manual trigger a flow action is added to the flow page.

Microsoft power automate convert string to integer

2. Next, we will get all the items from the SharePoint list. Click on the +New step -> select Get items action. Then provide the below information:

  • Site address: Provide the SharePoint site address
  • List name: Select the list from the dropdown.
power automate convert string to number

3. Next, we have multiple items in the SharePoint list; for this, click on +New step -> select Apply to each action. Then provide the below information:

  • Select an output from previous steps: Select value from dynamic content.
Microsoft power automate convert string to number

4. We will convert the string to an integer; for this, click on Add an action -> select Compose action. Then, provide the information below.

  • Inputs: Provide the below expression:
int(items('Apply_to_each')?['Price'])
power automate string to integer

5. Now, run the flow manually, and you can see the string is converted to an integer in Power Automate.

Microsoft power automate string to integer

This is how to convert the string to an integer dynamically in Power Automate from a SharePoint list.

Conclusion

In this Power Automate tutorial, we saw how to convert a string to an integer in Power Automate. We can use the int() function in Power Automate to convert a string to an integer.

You may also like:

>