Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Populating an Excel, Then converting it to PDF and Adding as an attachement

(0) ShareShare
ReportReport
Posted on by 629

I have a flow that works well as sperate flows, but i am trying to create a single flow that will take my excel template populate it, then convert to PDF and save in a folder, then add as an attachement to the Item in the SP list.

 

This section creates the excel fine.

jamescosten_0-1700137651058.png

I then have nother flow which is "When an item is created" it converts it to PDF. But i would like this flow to do this automatically.

 

I have tried to do this with the below flow but it does not work. Any ideas? This is directly after the Run Script Step.

 

jamescosten_1-1700137773245.png

 

 

  • Unknown geen idee Profile Picture
    1,755 on at
    Re: Populating an Excel, Then converting it to PDF and Adding as an attachement

    Dear J,

    You must have your reason for creating it as such ... but i see several options:

    1. Use 1 flow instead of 2 ... combine the 2 and not have the issue.
    2. Call up the 2nd flow from the first, use a child-flow construction (plenty of forum details on calling child flows). You can pass data along, I believe.
    3. Save data of the first flow (ID, path, ... anything) in a file/table/list, which you can retrieve in the 2nd flow.

    Hope this helps,

    Happy flowing,

    Koen

  • jamescosten Profile Picture
    629 on at
    Re: Populating an Excel, Then converting it to PDF and Adding as an attachement

    My flow works in two halves. The issue I have is that I use a second flow that see's that the excel has been created and then for the newly created Item it converts to PDF. This is all fine but the only thing I'm trying to solve with this flow is when the PDF is created it is added to the Sharepoint Selected Item as an Attachement. With two flows I cannot reference the first flow in the seond and as such it does not know the ID of the selected Item.

     

    jamescosten_0-1700567205584.png

    The Excel file is unique each time, with the ID in the file name which is why i cannot point the get file content to the folder, I need it to reference the file I just created.

     

    In essence I want to select an Item, Populate the Excel File, Convert to PDF and attach it to the selected Item as an attachment and I have been struggling for over a month now.

  • Unknown geen idee Profile Picture
    1,755 on at
    Re: Populating an Excel, Then converting it to PDF and Adding as an attachement

    Dear J,

     

    Since you are only sending bits and pieces it is difficult to see where things may go wrong. Overall the steps you are trying to do are well within what is possible.

    Suggest that maybe you try and test different elements in small pieces first before trying to combine everything is a big flow. For example in a seperate flow, create a file, set a delay and read the file ... to confirm the new file created can be used in the same flow. 

    Once you confirm different smaller bits, build it our more complicated.

     

    Regarding the 'Get contents', I would expect you just put in the ID of the file you just created, this should be available under the dynamic content of the 'Create file' action you use ... again, only after a longer delay will this work properly.

     

    Happy flowing,

    Koen

  • jamescosten Profile Picture
    629 on at
    Re: Populating an Excel, Then converting it to PDF and Adding as an attachement

    The Script takes the Sharepoint Data, and adds that data to specific fields in the Document Template we have. The Script just replaces the values with the SP data. This then saves the excel file and I convert them to PDF.

     

    The Delay has been added but it shows an error.

    jamescosten_2-1700564027208.png

    Because I populate an Excel and place in a folder, and want that converted to PDF what file identifier do i use. 

    jamescosten_3-1700564151862.png

    Should I replace get file content with Selected File?

  • Unknown geen idee Profile Picture
    1,755 on at
    Re: Populating an Excel, Then converting it to PDF and Adding as an attachement

    Dear J,

     

    Not sure what you try to do in the 'Run script' action and what is the relevance ... but to me it looks perfectly possible to let the flow run as you intend to ... provided that you build in a large Delay or Do Until between the creation of the file and any actions that follow this.

    A newly created file needs time to be 'usuable' in the same flow. Try first a delay of 5min (can try reduce later) to use a newly created file.

     

    Happy flowing,

    Koen

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May 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 >