Best answer

How to extract full body of Word docs attachments in an email to Wordpress?


Userlevel 1

Hey! So I’ve tried this a ton of ways and still can’t figure this out.

On a regular basis, I am emailed a Word doc, which I would then open, and copy and paste into a Wordpress post - links, formatting, and all. I have the trigger figured out, but I can’t figure out how to instruct Zapier to extract the full body of the Word doc? I’ve tried parser, webhooks, and more, but best I can extract is plain text.

To be clear, I have the trigger down, and post to Wordpress down, but I need to figure out how to extract the full body of the Word doc. I can also add a step that uploads it to a Google Drive folder and treats it like a Google Doc, if needed. But whether Google Doc or Word doc, I haven’t been able to make this work.

 

Thank you!!!

icon

Best answer by scwei 15 July 2022, 13:50

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

7 replies

Userlevel 4
Badge +6

Hello @scwei 

A workaround could be parse the data from that doc and store the data in Airtable using the LongTextFields for every piece of information that you need to add on the new doc.

Longtext fields supports   formatting so you can achieve the formatting like what you have earlier in the new Google Doc by using Zapier to Generate Document from the Template mapping the data from Airtable that contains the data.

Try this and see if this workaround works

Userlevel 1

@Satya09 hey thank you!! SO I tried it but it didn’t make much of a difference. I’m trying it out with Parse Webpage and I’m seeing how it goes. OVERALL it seems to work but I think it’s truncating text in some instances.

Userlevel 7
Badge +9

Hey @scwei how are things going with parsing the web page? It sounds like you’re running into some scenarios where the text is being truncated. Are you able to share more insight/examples? Which parsing app are you using? Happy to keep working through this one with you!

Userlevel 7
Badge +12

Hi @scwei 

Can you send HTML to the Wordpress post action? If so, here is what i would try:

Have Zapier send the word doc file to Google Drive (i would use the replace file action so as to not clutter up your drive with a bunch of files but rather just 1 file that gets overwritten each time you get an email. This would require that you upload a file first though). As long as it is treated like a word doc i believe you should get back an export link to the HTML version of the file. 

Then run that export link into a javascript code block to get the HTML Text. 

let response = await fetch(inputData.html_file, {
method: "GET"
});

let data = await response.text();

return {data}



🤞🤞
Tim @Getuwired

Userlevel 7
Badge +9

Hey there, @scwei! I wanted to swing by and see if you were able to get this sorted with @GetUWired’s recommendations? 🙂

Keep us posted!

Userlevel 1

Hey all! SO sorry I’m so behind! All of this is extremely helpful! What ended up working for me was

  • New Gmail attachment
  • Only continue if .docx
  • Upload file in Google Drive
  • Parse webpage

Thank you!!

Userlevel 7
Badge +9

Yay! Thanks for swinging back around to let us know your solution! We’re so glad you were able to get this working. 🤗