Showing results for 
Search instead for 
Did you mean: 
New Member

Trying to convert files to PDF

I have a pretty simple flow that needs to find xls files in a folder then convert them to PDF (by printing only page 1 in portrait format). I'm starting though with just trying to convert files and save them in the same folder and am having problems. After much trial and error I arrived at the following:

1. Recurrence (I can't find any better way to trigger this because I don't want to have to add a file to a folder just to do so)

Find Files in Folder: Pattern .xls, and selected the folder where they reside.

So far it works, it finds the four .xls files in that folder.

2. So the next step I have is Apply to Each

For "select output" I have no choice but "Body"

then "convert file" file="id" target type = "pdf." I tried other things like "file name" for convert file, but all of those fail. "ID" was the only one I got to work.


The flow says it runs successfully but I'm not seeing the converted PDF files. I tried "Convert by file path" but it won't let me just enter the path to the .xls files, it insists on my selecting a particular file!


I just picked up Power Automate last week so I'm brand new to this. Can anyone point me in the right direction?

1. Find files *.xls in a particular folder

2. Print Page 1 only as PDF.


Also is there any way to get the flow to run manually or is it better to just do it as files are copied in to that folder? The problem is that there will be multiple folders these .xls files are saved in.



Super User
Super User

Re: Trying to convert files to PDF

Hi @tomservo75 

After the 'Convert File' action has run you need to add a 'Create File' action to add the converted PDF file to the desired location, for example:


The OneDrive connector will not allow you to convert a single page... you'll need to use a third party connector. An example of how to get just the first page of a PDF using the Encodian connector is detailed below:



A few notes on the expressioms used:


  • Split PDF
    • Split Configuration: you could simply use [1-1] which would return only the first page a single document in the returned array. The current [1-1], [2-999] will return two documents in the returned array... the first containing the first page and second PDF all pages from 2 to 999 or whatever is the last page.
  • Create File
    • File Name: first(body('Split_PDF')['documents'])['fileName'] - This expression gets the filename property of the first document returned in the array of documents returned by the 'Split PDF' action.
    • File Content: base64ToBinary(first(body('Split_PDF')['documents'])['fileContent']) - This expression gets the file content property of the first document returned in the array of documents returned by the 'Split PDF' action and provides in the correct format to the 'Create File' action




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

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

Helpful resources


New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!


Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (8,208)