Forum Discussion
Rich Koneval
Mar 28, 2019Brass Contributor
Flow Action - Convert Word Document to PDF
I'm trying to use the Convert Word Document to PDF action in a Flow. There are three parameters that have to be entered: Location - the SharePoint Site Document Library - Library where the documen...
AliS2445
Aug 10, 2024Copper Contributor
Hi guys, I was able to resolve this issue !!!
The problem is with the extended path format which you get from a dynamic value of sharepoint file.
My flow basically includes creating a file at sharepoint first, and i'm getting the path from the outputs of body/Path of "Create item".
So what you need to do is to add a "Compose" action before the conversion to split the path and give below value:
concat('/', join(skip(split(outputs('Create_file')?['body/Path'], '/'), 2), '/'))
you can change the dynamic value of create file as per your flow.
the output path i was receiving from Create file was:
"Path": "/Shared Documents/My Library Name/My Library Folder/My file name.docx"
which was unacceptable by word online action. so after the compose action my output looks like this:
/My Library Name/My Library Folder/My file name.docx"
and with a miracle it started working.
Detailed Explanation for Advanced users:
So at my compose action what i basically did was:
concat('/', join(skip(split(outputs('Create_file')?['body/Path'], '/'), 2), '/'))
- The split function divides the file path into an array of segments using / as the delimiter
- The skip function removes the first two segments of the array. This is because the first segment is empty (due to the leading /), and the second segment is the document library name (Shared Documents), which we don’t need in the relative path.
- The join function combines the remaining segments back into a single string, with / as the separator.
- The concat function adds a leading / to the joined string to form the correct relative path:
Also i would recommend you to add a short 30 second delay before conversion, as the file sometimes takes few seconds to appear in the document library and the next action runs immediately which leads it not to find the file and give error.
The problem is with the extended path format which you get from a dynamic value of sharepoint file.
My flow basically includes creating a file at sharepoint first, and i'm getting the path from the outputs of body/Path of "Create item".
So what you need to do is to add a "Compose" action before the conversion to split the path and give below value:
concat('/', join(skip(split(outputs('Create_file')?['body/Path'], '/'), 2), '/'))
you can change the dynamic value of create file as per your flow.
the output path i was receiving from Create file was:
"Path": "/Shared Documents/My Library Name/My Library Folder/My file name.docx"
which was unacceptable by word online action. so after the compose action my output looks like this:
/My Library Name/My Library Folder/My file name.docx"
and with a miracle it started working.
Detailed Explanation for Advanced users:
So at my compose action what i basically did was:
concat('/', join(skip(split(outputs('Create_file')?['body/Path'], '/'), 2), '/'))
- The split function divides the file path into an array of segments using / as the delimiter
- The skip function removes the first two segments of the array. This is because the first segment is empty (due to the leading /), and the second segment is the document library name (Shared Documents), which we don’t need in the relative path.
- The join function combines the remaining segments back into a single string, with / as the separator.
- The concat function adds a leading / to the joined string to form the correct relative path:
Also i would recommend you to add a short 30 second delay before conversion, as the file sometimes takes few seconds to appear in the document library and the next action runs immediately which leads it not to find the file and give error.
- StefalbertJun 19, 2025Copper Contributor
I was used your solution and indeed worked!!
Thank you so much!