Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 36aHUYs4SmMXy3zrDQ44g7
Power Automate - Building Flows
Answered

Convert Word Document to PDF after Creating New File in SharePoint from Word Template

Like (0) ShareShare
ReportReport
Posted on 25 Apr 2022 08:43:47 by 31

Dear PowerAutomate Community,

 

I am trying to expand my Flow to Convert the filled Word File from the Word Template but I am unable to do this and I'm getting error.

 

After creating the word file, I added an action to convert the newly created word file to PDF using the Output "Name" from earlier step using the Convert Word Document to PDF then create a new file as PDF (As shown in Screenshot#1). However, I am getting the below error as shown in Screenshot#2. 

 

Screenshot#1

Capture#1.JPG

 

As you can see in Screenshot#2 the word file has been created but the PDF I'm getting the error, I would like to have both copy of the PDF and Word File in the same location, I have the variable for the dynamic file path, I also added a delay of about 30 seconds after the word file is created in SP Library but still getting the same error.

 

Screnshot#2

Capture#2.JPGimg-13.jpg

 

In addition to above, I have tried to do another Flow which being deployed when a new file is created in SP and this flow will then create a file in Business OneDrive then Convert the new Word file into PDF then delete the file once the PDF is created and saved in SP library (This Approach Works Perfectly!!), However, this approach have at least 20-50 seconds delay before the PDF file is created in the same SP Library Location. Is there anyway to make it in one Flow as to form part of Screenshot#2. 

 

Capture#3.JPG

 

Any help is greatly appreciated.

 

Thanks,

Edward

  • lchap Profile Picture
    16 on 22 Apr 2024 at 17:40:11
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    Hi I tried your solution and in the initialize variable I'm getting the error:  The input parameter(s) of action 'Initialize_variable' contain an invalid reference to 'Get_file_poperties'. Correct to include a valid reference to 'Get_file_poperties' for the input parameter(s) of action 'Initialize_variable'.

     

    This is what I have for Initialize varialbe: 

    split(outputs('Get_file_poperties')?['body/{Path}'],'/')
     
    Please advise
  • Verified answer
    Dubya-eye-el-el Profile Picture
    58 on 08 Apr 2024 at 17:57:47
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    @GeorgiosG , for the file name I simply used an expression in 'sharepointlibrary/documentfolder' and then added the dynamic content of the file name from after. This seemed to work fine for me.

    Dubyaeyeelel_0-1712599059175.png

     

  • Ultimo Profile Picture
    16 on 24 Jan 2024 at 16:51:08
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    Scusate ragazzi qualcuno potrebbe dirmi che tipo di colonna inserire in sharepoint per riportare un test di gradimento eventualmente in word, logicamente inserire il tutto nel flusso? 

    Cioè io ho un sondaggio nel form e vorrei riportarlo nel documento word solo che non capisco che tipo di colonna aggiungere in sharepoint.

  • Mielkew27 Profile Picture
    31 on 03 Jan 2024 at 14:13:45
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    @deakowen1 I ended up using a switch since I had only a few Word template forms that I needed to fill out and convert to PDF format. Works for me! 

     

  • deakowen1 Profile Picture
    10 on 03 Jan 2024 at 14:03:35
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    I have also run into this problem and it looks to me as if the Convert Word to PDF action does not support Environment Variables/non Hardcoded libraries for the Document Library.  This becomes a manual step for those of us that need to promote to PRD.

     

    HEY MICROSOFT!  Fix the issue with the action!!

  • Verified answer
    schwibach Profile Picture
    Super User 2025 Season 1 on 28 May 2023 at 08:50:46
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    This only works with OneDrive as a data source. With SharePoint it seems a bit more special.

    I solve my workflows by using OneDrive for business to convert the documents and then save in SharePoint.

  • kashif21 Profile Picture
    4 on 28 Dec 2022 at 11:04:58
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    Hi,

     

     you can simply use the file name of the newly created file.

    as shown in the blow screenshot.

     

    kashif21_0-1672225181974.png

     

     

  • Mielkew27 Profile Picture
    31 on 25 Apr 2022 at 09:07:21
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    Hi @GeorgiosG  I will try to digest and try the solution that you have provided. I have done the OneDrive approach and currently firing this approach perfectly however, since my trigger is from PowerApp which is directly populating a word template then creating a file in SP library, the PDF file generation takes about 20-40 seconds delay.

     

    Anyway, Thank you so much for your help. I hope I can follow and make the solution you provided.🤞

  • Verified answer
    GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on 25 Apr 2022 at 09:01:57
    Re: Convert Word Document to PDF after Creating New File in SharePoint from Word Template

    Hi @Mielkew27 

     

    I made a test on my site and it seems that the connector Convert Word Document to PDF seems to be a bit special for its input parameter. 

     

    It seems like the connector is not accepting the internal Library name / path, it needs the DisplayName or selecting the proper Document Library in the drop down. I was not able to find the libraries display name in an Output from an action before. 

     

    Try selecting the library in the drop down.

     

    For the Filename, I was also not able to find a proper value from an action before which is working as variable. I created an own variable and modified the Full Path. What we need here is the Path (Without Library), therefore you can work with Split() expression and Split with '/'. In the Convert Action you can use concat() and add at the end the "File Name with extension". This worked for me. 

     

    Maybe someone else have a better solution how to solve this better / more dynamically. 

     

    Screenshot 2022-04-25 at 10.26.08.png

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,660 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