Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Es44gxaTtANoZdftm+wDeN
Power Automate - Building Flows
Unanswered

Trying to convert an excel to PDF

Like (0) ShareShare
ReportReport
Posted on 7 Oct 2021 17:58:22 by 16

Im trying to build a flow to convert a sheet in an excel file into a PDF s that a second flow can email it out as an attachment but im failing at the first hurdle. my flow to convert to PDF wont run.

 

Id already added a step to copy the file from sharepoint to one drive as i couldnt find a convert tool to do it direct from sharepoint.

 

My flow looks like this..

 

FayHudson_0-1633629235991.png

 

error message ...

 

FayHudson_1-1633629376958.png

 

FayHudson_2-1633629419840.png

 any ideas??

 

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 14 Oct 2021 at 18:56:58
    Re: Trying to convert an excel to PDF

    Hi @FayHudson 

     

    One possible way to do this is to use the 2nd of two office scripts in this video https://youtu.be/4ZiMjjV1c3Q which allows you to delete sheets from an existing file. 

    Please consider accepting my answer as a solution if it helps to solve your problem.

    Cheers
    Damien

    Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks

  • FayHudson Profile Picture
    16 on 14 Oct 2021 at 09:24:55
    Re: Trying to convert an excel to PDF

    I have now got the flow to succeed and create the PDF - however the flow seems to run twice and the first time it succeeds and then creates a failed run as well? Not sure if this is important?

     

    The convert to PDF flow is as follows:

    FayHudson_0-1634203402519.png

     

    Im guessing now once ive copied the original file to one drive  i need to understand how to delete the other worksheets to enable the PDF creation to occur. Is it best to do that or simply only copy the relevant worksheet?

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 14 Oct 2021 at 08:12:47
    Re: Trying to convert an excel to PDF

    Hi @FayHudson 

     

    Exactly that. Yes.

  • FayHudson Profile Picture
    16 on 14 Oct 2021 at 08:11:26
    Re: Trying to convert an excel to PDF

    Sorry @DamoBird365  Im not sure I understand what you mean, as in save a copy of the file i want to convert but with all the other sheets stripped out and then see if the conversion works?

     

    Thanks

    Fay

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 14 Oct 2021 at 05:29:33
    Re: Trying to convert an excel to PDF

    Can you try it on the sheet that you want to save as pdf? If that works, I can give you a solution for stripping out the other sheets on your copy file.

     

    Damien

  • FayHudson Profile Picture
    16 on 13 Oct 2021 at 21:36:32
    Re: Trying to convert an excel to PDF

    it works with a simple excel file so is clearly an issue with the excel file itself!!  

     

    Thanks - but now still at a loss as to how i resolve

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 13 Oct 2021 at 21:02:42
    Re: Trying to convert an excel to PDF

    @FayHudson maybe?! Joys of testing and troubleshooting these things. I’ve just read over the docs https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get_content_format?view=odsp-graph-online and whilst there are known limitations, i can’t see anything about complex or multiple sheet workbooks. Can you try the routine on a simplified version of the workbook? Remove all but one sheet? 

    Using office scripts, it is possible to remove additional sheets but we need to discover if that’s the cause first.

     

    Damien

  • FayHudson Profile Picture
    16 on 13 Oct 2021 at 20:55:58
    Re: Trying to convert an excel to PDF

    Hi @DamoBird365 

     

    Now that you mention it, it is a spreadsheet with a number of sheets that contain tables feeding into a query.  Is that a problem?

     

    Ultimately im only copying to one drive because i cant find a convert to PDF straight from sharepoint (unless im missing something else that could help?!)

     

    I have a file in excel and each week i want to issue a PDF of one of the sheets out to a dist list

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on 13 Oct 2021 at 20:49:01
    Re: Trying to convert an excel to PDF

    Hi @FayHudson 

     

    Can you open the file on OneDrive? How basic or complicated are the contents of the file? 

     

    Damien

  • FayHudson Profile Picture
    16 on 13 Oct 2021 at 20:45:19
    Re: Trying to convert an excel to PDF

    Thanks Damien, however the previous flow to create the xls file in one drive appears to be working so im not sure what is going wrong?

     

    The previous flow is as follows:

     

    FayHudson_0-1634157587556.png

    This flow successfully runs and i can see the xls file now in my one drive

    FayHudson_1-1634157717014.png

    Any ideas?

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started