How to extract text from a Google Doc using a webhook

  • 30 March 2022
  • 1 reply
How to extract text from a Google Doc using a webhook
Userlevel 7
Badge +11
  • Community Manager
  • 2002 replies

Hey folks! I recently came across a topic in community that asked whether it was possible to take the text from a Google Doc and put it in an email. In the topic it was noted that it is possible to get the text, but that’s only when using the New Document or New Document in Folder triggers for Google Docs.

Depending on your workflow those may not be triggers you want to use. And unfortunately the Find a Document search action doesn’t output the content of the file so you can’t access the content from there. Which got me thinking, is it possible to use the file that’s returned from the Find a Document search action and somehow extract it via a Webhook? Well, as it turns out, it is! 🙂

Find the File

So how do we do it? Well first we need to set up a Find a Document search action to locate the file we want to extract the text from. To do that you’ll want to select the relevant Folder and enter the name of the file we’re looking for into the Document Name field. 


Create the webhook

Next, we’ll use a GET (Webhooks by Zapier) action and in the URL field, select the File Txt field that is output from a Find a Document search action. The set up should look like this:

That will then extract the text from the Google Document:

Remove any unwanted characters

You’ll notice that at the start of the text that’s output by the webhook step there’s some weird characters () that’s also been extracted. But that’s ok, a Formatter (Text > Replace) step can easily get rid of that, like so:

You can find out more about how to replace text with Formatter here: Modify text formats in Zaps 

Now you’re ready to select that formatted text in whatever step you want to use it in: 

Wrapping up

And there you have it! A relatively quick way to use a Webhook to extract text from a Google Doc. I’ve not tested this approach with other apps that supply file objects like the one in the File Txt field but it’s totally possible that this approach could work for other apps as well. 

Anyway, that’s it from me for now. Happy Zapping! ⚡

1 reply

Userlevel 1

It doesn’t seem to be working for me. I can’t find specifically 2. File Txt from the output of Google docs. However, I did find 3. File Txt (exist but not shown) and when I test the webhooks it doesn’t output the data? 


Is there a recommended workaround or does this workflow still work?