Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Convert txt file from email attachment to pdf



I'm looking to create a Flow that will take a txt file that is an attachment in an email, convert it to pdf and then save on an FTP.


Does anyone know how to do this?



Resident Rockstar
Resident Rockstar

Try the following


Assuming you have the content of your attachment already.

Try the following actions:

Create File (OneDrive for Business) to store the file in onedrive

Convert file (OneDrive for Business) to convert the previously stored file to PDF


then use a ftp action to upload the pdf as required.


There are other PDF converters but they are usually subscription based

Community Support
Community Support


Hi @gm355 ,


As Gristy suggested, please refer to the following configuration, I use SharePoint to save the PDF file as an example:


Hope it helps.


Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks. I've tried that, but I keep getting the following error.




Hi @gm355 ,


Please try to change Convert file action to Convert file using path action.



Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-bacao-msft ,


Getting this error now:



Not applicable

I'm getting the above error also for converting simple txt file

Hi @Anonymous , I never found a solution for this unfortunately.

Community Champion
Community Champion

Hey @gm355 @Anonymous @v-bacao-msft @Gristy 

I just ran a few tests on this as well... TXT file conversion fails via the OneDrive connector.

Same files convert fine via third party connectors such as the Encodian connector - Convert Text to PDF

See details below:








If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up.

Not applicable

Hi Guys, create a text file in .html format then convert to pdf is currently supported (while txt to pdf is not supported according microsoft premier supported). So the below is working for me. I think this presents a valid and easy workaround as creating a html is just a matter of wrapping your txt file with <html> and <body> tag with some <br> sprinkled around. 



Thanks @Anonymous , can you show the full workflow please?

Frequent Visitor

I was able to solve this as follows using the OneDrive for Business connector:

  1. Create a conditional that checks to see if the file Name ends with .txt
  2. If yes, Move or rename file where the File is the ID from above, and the Destination File Path is Name without extension.htm
  3. Next I used Convert file using path with the Path value from above and set the Target type to PDF
  4. I used Create file action to create the file by using the File Name and File Content resulting from the Convert action in step 3
  5. Finally, I use the Delete file action to clean up where the File input was the Id from the Move operation in step 2.

Hope this helped!

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,965)