Reputation: 137
Using Microsoft Power Automate Desktop (PAD), I have captured a moderately long string called ExtractPDFText. I can display the text in a message window, now I need it to run through Python Script.
In the Power Automate Desktop application's python input box I am just trying to get it to run this:
x = str(%ExtractedPDFText%)
print("work")
But it keeps returning an "unexpected token"
How should I be reading this variable? I tried with and without the str() function.
Upvotes: 1
Views: 3134
Reputation: 5522
Here is a fleshed out answer - thanks to the comment from user2502794. Start by writing a Python script which works in Python:
This just returns all the strings in a list which contain the letter "s".
Now in Power Automate Desktop, set the value of a test variable:
Add a Python script action:
You could now display the value of the output, as captured in the PAD variable:
This would give this for our example:
What I can't do is work out how to return a list, rather than string representation of a list. I suspect the answer is that I now have to remove the square brackets and use a PAD Split text action, but this seems clunky, but I'm excited to be able to do all my text processing in Python now (watching PAD looping over the items in a list wasn't that exciting ...).
Upvotes: 0