cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kudo Kingpin
Kudo Kingpin

Create file - word document corrupt

Why can't I create a simple Word document in a SharePoint library? I have created some extremely complex Flows but this simple task seems impossible. I have tried .doc, .docx and no extension. No extension produces a file that can be opened, but I have to download first and chose Word (obviously not what I want). I have tried changing the library template, etc. Changed the file content to all different types of things. What is actually the correct way to do this? What is it that is causing this?

 

To clarify, the flow runs fine, but the resulting file cannot be opened but instead says "Sorry, Word ran into a problem opening this document...". Will not open in Word application either (says file content corrupt).

 

PowerAutomate Create Word.png

5 REPLIES 5
Dual Super User II
Dual Super User II

Hi @PhilD 

 

You cannot pass text directly in file content to create a word document. This setup works only for .html, .txt, .json, .csv etc. For the word document, you have to pass the binary content of the file. And this can be done if you are getting a word doc in an email attachment and you want to create it on sharepoint or if you create a word template, you can populate that using dynamic data and then create the word document. Example: https://tahoeninjas.blog/2020/03/13/generate-word-documents-from-a-template-using-power-automate/

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thanks for the reply! I actually had tried the content with a variety of different approaches. this flow is triggered in a power app and what I was trying to do was take HTML content from a powerapps HTML content control, which derived some fields from a gallery item, and then use it for the content of the word document. I suspect the HTML content I brought in did not work because the power apps HTML content control is not strict HTML or is in some other way not in the right format.

 

I appreciate your help, this is kind of an area where it's not clear on how to approach validating that the format coming in is correct. Let me know if you have any additional thoughts that might be helpful on this.

@PhilD 

 

Hey Mate,

 

In tha past I have user Muhimbi Convert HTML to docx.

 

CFernandes_1-1601743406987.png

 

Muhimbi support a wide cross conversion of file types, https://support.muhimbi.com/hc/en-us/articles/228089047 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

 

Dual Super User II
Dual Super User II

Hi @PhilD 

 

In my opinion the best way to do this is to create a word template with all the place holders and then pass the data from Power Apps (even if it is coming from the gallery) and then populate those place holders using the populate a word template action using the word online connector. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

This seems like a good idea. I will give this a go when I get a chance to sit down with this again. The reason I was originally trying to build the HTML in PowerApps was because I was gathering up an item from a gallery and also associated items (one, or more than one) from another gallery (i.e. a parent/children type arrangement). The template approach is likely the best one but may not be able to handle this as easily.

 

I'll post back with my results after I get a chance to get in there and get my hands dirty with this. Thanks for pointing me in the right direction!

Helpful resources

Announcements
New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (44,723)