Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Convert SharePoint TXT File into PDF File

(0) ShareShare
ReportReport
Posted on by 85

I try to get a very simple flow to work.

 

The flow have trigger, a SharePoint Create File and a OneDrive Convert file (for Business)

 

Nusserdt_0-1706427956388.png

 

The step OneDrive Convert file (for Business) fails with:

"status"400,
"message""The file id '%252fRechnungsablage%252ftemporary%252ftest.txt' is not valid.",
"source""api.connectorp.svc.ms"

 

The input of the step is the body/Id from the SharePoint Create File step.

 

Nusserdt_1-1706428350458.png

 

I also try the Adobe PDF Connector to convert files to PDF with out success.

Is there a working example how to convert a SharePoint TXT File in to PDF File?

 

(and for the step after: merge the created PDF File with an existing PDF File)

  • royg Profile Picture
    on at
    Re: Convert SharePoint TXT File into PDF File

    To answer you questions,

    A: The files will be created in your OneDrive (but you can change the connection to another account if that bothers you). You don't have to share the created files with anyone, you can copy them back to SharePoint as PDF files if you want, or send them as Email attachments, that's for you to decide. After you perform your last action, you can delete the created files (html and pdf) from your OneDrive.

    B. Same as A...

     

    I agree that the design is not flawless but at least it doesn't require a premium / paid actions.

     

    If that still bothers you, there is a way that's a little more complicated that you can consider. This one will not generate a PDF file but rather can send a link for the users to open a PDF file in their browsers which they can choose to download if they want.

     

    This is an idea I borrowed form Reza Dorrani's (@Reza ?) old video (here: PowerApps PDF Viewer SharePoint Document Library without flow - YouTube). It basically uses the Thumbnail to transform the HTML file to PDF.

     Instead of creating the HTML file in OneDrive, create it in SharePoint:

    royg_0-1707651837238.png

    Add a Get file properties and set the Id to the newly created item's id:

    royg_1-1707651920933.png

    Add a Compose action to get the Thumbnail URL and replace the thumbnail with pdf:

    royg_2-1707651991955.png

    The expression:

    replace(outputs('Get_file_properties')?['body/{Thumbnail}/Large'], '/thumbnail', '/pdf')

    Now you can send an email/Teams notification to open the pdf file:

    royg_3-1707652155791.png

     

    Hope this helps

     

     

     

  • Nusserdt Profile Picture
    85 on at
    Re: Convert SharePoint TXT File into PDF File

    Hey @RO thanks a lot for your reply and sorry for my late response!

     

    I try to follow your instructions. A problem I still have is the fact that the flow should get used by multiple colleagues. If I use OneDrive to create/convert files, which OneDrive space get used? Ofc in flow declaration I have to decelerate my OneDrive folders, but what happy if some one else uses the flow?

     

    A: Will there files get created in my OneDrive (do I have to share my personal folder with everyone who uses the flow)?

    B: Will there files get created in there personal OneDrive space?

     

    This is why I don't really like the design. Share Flows should use shared resources, so it would be much more straight forward if I could SharePoint only. But I accept that SharePoint is not able to create PDF Files, even I do not understand that very low hanging fruit do not get implemented.

  • royg Profile Picture
    on at
    Re: Convert SharePoint TXT File into PDF File

    Hi @Nusserdt,

    Trying to improve my answer, hope it resolves your issue.

    If you have a SharePoint folder where TXT files are created and upon creation you want to convert them to PDF files so you can send/store them elsewhere, please follow this guideline:

    1. Set the flow trigger to "When a file is created (properties only)"

    royg_0-1707035957245.png

    2. Add "Get file content" action and set the File identifier

    royg_1-1707036063141.png

    3. Add OneDrive "Create file" action and rename to "Create file HTML".

    3.1 Set the File Name property to the "Name" property of the trigger outputs and add ".html" extension

    3.2 Set the File Content to: "replace(body('Get_file_content'), decodeUriComponent('%0A'), '<br>')". This takes the text file contents and replaces line breaks with "<br>" tags.

    royg_2-1707036520860.png

    4. Add "Convert file (preview)" action and select the previous action's "Id" as inputs of the File property and select PDF as the Target type.

    royg_3-1707036648862.png

    5. Add another "Create file" action and rename to "Create file PDF". Set File Name to previous action's File name and the File Content to that action's File content.

    royg_4-1707036833657.png

    Result:

    Once a file is created in the specified folder, new HTML and PDF files get created in your OneDrive folder.

    royg_5-1707036951768.png

     

    royg_6-1707036977438.png

    royg_7-1707037045840.png

     

    Note:

    You can now use actions like Send Mail to forward the created PDF file, store it elsewhere or whatever it is you planned to do with the file. It's also wise to delete the HTML files.

     

    Hope this helps

     

      

     

  • Nusserdt Profile Picture
    85 on at
    Re: Convert SharePoint TXT File into PDF File

    Hey Guys, so I understand that it is not possible to convert simple SharePoint Files with Flows even with a premium license (and without 3rd Party connectors)?

     

    I also try the ADOBE connector:

     

    Nusserdt_0-1706948174773.png

    But I do not really understand what the input of the File Content is. Why I couldn't simply enter a path to a SharePoint file? Why is it so complex?

  • royg Profile Picture
    on at
    Re: Convert SharePoint TXT File into PDF File

    Hi @Nusserdt,

    To Convert your text file to PDF, save it with HTML extension in your OneDrive folder, then use the Convert action as you already have, and lastly use Create action to with the output of the Convert action to create your PDF file:

    royg_0-1706433886473.png

    royg_1-1706433990820.png

    Finally, you can delete the HTML file (not mandatory).

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1