For this post, we’re exploring how to determine languages with Power Automate. To do so, let’s extract the text from a Word document using Encodian’s Flowr ‘Get Text from Word‘ action.
Once you have the extracted text, you can do many things with your Power Automate flows. For today’s scenario, let’s say we work at a company that operates in England, France, and Spain. As documents are created, they are uploaded into a folder in SharePoint. This will trigger a Power Automate flow to extract the text from these documents, identify the language used, and update the language property column accordingly so the files can be filtered and grouped more easily.
The ‘Global Documents’ document library in SharePoint contains a choice column named ‘Language’;
The ‘Language’ column will be updated by the Power Automate flow once the language of document (extracted text) has been determined.
The Power Automate flow is triggered by the ‘When a file is created (properties only)’ trigger action:
Once the flow has been started, we retrieve the file from SharePoint using the ‘Get file content using path’ action:
Now we can extract the text from the document! We can do this using Encodian Flowr’s ‘Get Text from Word‘ action:
As we only need enough text to identify the language, you could limit the results to the first or first two pages. You also have the choice to:
Once we have the extracted text, we can identify the language using an AI Builder prebuilt model called ‘Detect the language being used in text’.
We can then use a ‘Switch’ to check what language the document is in and update the file properties in SharePoint accordingly. I have added a ‘Terminate’ action into the default case which will mark the flow as failed to make troubleshooting easier. You could also send an alert here to the owner of the flow.
I am using an expression for the inputs of the ‘Switch’ to avoid an ‘apply to each’ loop being used, as there will only be one result from the AI builder action:
outputs('Detect_the_language_being_used_in_text')?['body/responsev2/predictionOutput/results']?[0]?['language']
To test the flow, I have three documents each in a different language.
After uploading the documents we can see that the Language column is empty:
After the flow has run:
As we can see from the image, each document’s language has been correctly identified. This will make it a lot easier to filter and find documents for a certain language. You could also edit the flow to actually move the documents into a folder for their respective language if this is the way your SharePoint structure is set up.
Language detection is only one of many different things you can start to do once you have extracted the text from a Word document.
Check out Sophie’s companion video, or head straight to YouTube to watch all our tutorials.
Search 150+ Actions to see how Flowr can save you time
Sign up for your free 30-day trial; no cards, catches, or contracts.
No job is too big or too small for our Professional Services team!
UPDATE: We’re excited to announce some significant updates to Flowr for Power Automate! As of October 2024, we’ve improved by updating action names and splitting Flowr’s central Power Automate connector into nine specialized connectors. These changes will make your workflow faster, smoother, and more efficient. The new action names are more precise and intuitive, saving you time, while the focused connectors enhance performance and flexibility. This update also helps future-proof the platform for even more powerful features. Check out our updated action names blog.
Technical Evangelist