How to Check the Text Encoding of a CSV File in Power Automate

Cloudmersive
4 min readNov 25, 2024

--

Most of the text content we deal with on a day-to-day basis uses UTF-8 text encoding — and for good reason. UTF-8 supports all Unicode characters, has backwards compatibility with ASCII characters, and efficiently handles a very wide range of symbols.

It’s entirely possible, however, that data we receive from an external source won’t bear the same text encoding as the files we’re used to. If, for example, we were to receive a CSV file with international characters and import that file into our database from Power Automate, we might find accented characters displayed as “�” characters in our system.

Checking a file’s text encoding validates that its content will display properly in our system. In Power Automate, we can easily check text encoding with the Cloudmersive File Processing connector — and we’ll build a quick example flow in this article to demonstrate that process.

We’ll build a manually triggered instant cloud flow which checks the text encoding of an example CSV file and triggers a subsequent condition based on the returned text encoding value.

We’ll start by adding a Get file content action to retrieve an example CSV file from our system.

Next, we’ll add a new action and type “Cloudmersive” into the connector search bar. This brings up a list of several Cloudmersive connectors, each of which offers a different category of value-add actions. We’re looking for the Cloudmersive File Processing connector on this list, which has a purple logo.

Once we find this connector, we’ll click “See more” to view the actions list. From there, we’ll look for an action called Detect text encoding of file and select it once we find it.

If we’re new to using the Cloudmersive File Processing connector (or any Cloudmersive connector), we’ll need to create our connection and authorize it with a Cloudmersive API key before we can view the request parameters. We can get a free Cloudmersive API key by visiting the Cloudmersive website and creating a free account (this allows a limit of 800 API calls each month, with zero commitments).

After we’ve finished creating and authorizing our connection, we’ll add our CSV file content in the initial request parameter, and we’ll then add a file name in the subsequent parameter. We don’t need our file’s real name for this request to work properly; notice that I’ve added a placeholder name in my example.

Finally, we’ll add a Condition control to our flow, and we’ll set the body/TextEncoding response from our Detect text encoding action equal to UTF-8. This indicates we don’t want files without UTF-8 encoding reaching the True branch of our condition.

Now we’ll save our flow and run our test. In this small-scale test, we’re only aiming to confirm that our condition was triggered correctly.

In my example, we’ll notice that my Condition returned a “true” expressionResult. This validates my example file was indeed encoded in UTF-8.

Just like that, we can now easily validate our data’s text encoding before processing that data in subsequent flow actions.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet