Skip to main content

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. 

7a0430a251c0fb88bc7a9b68968a1555.png

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:

ec85786697d6d62ab2e89588d82af5a0.png
That will then extract the text from the Google Document:
eff91a831185d348cdc92e1b5b792152.png

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:

af14380b738d3b11b0d4037e23b8d9dd.png
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: 
8b4cc9ca854f817592ecf65dcfa9e05b.png

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! ⚡️

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?


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?

I too face the same issue as this. what is the workaround?


@SamB This solution doesnt work anymore. Please update the solution.


I figured out the work around:

 

Web Hook > Custom Request > Method: Get > URL: File txt: (Exists But not shown)> continue 

 


Neither Sam B’s solution, Nor Joe Z’s version seems to work for me.


You need to add a step to make the file shareable BEFORE you perform the GET function. Otherwise, you’re trying to access a file that’s not accessible by an outside entity. 

 

  1. Use this Action: Add File Sharing Preference in Google Drive
  2. Find your file ID from the Google Doc step
  3. Change the permissions. I make mine “Anyone on the internet who has the link can view” - obvs be careful what you put out there. Don’t make discoverable. 

After you add this step, you can now perform the GET as described above and it’ll find the file. 

 


You need to add a step to make the file shareable BEFORE you perform the GET function. Otherwise, you’re trying to access a file that’s not accessible by an outside entity. 

 

  1. Use this Action: Add File Sharing Preference in Google Drive
  2. Find your file ID from the Google Doc step
  3. Change the permissions. I make mine “Anyone on the internet who has the link can view” - obvs be careful what you put out there. Don’t make discoverable. 

After you add this step, you can now perform the GET as described above and it’ll find the file. 

 

This is the solution. I created a folder in GDRIVE that was public by default and added the document there. Then used 'Export Links Plain Text' option and it worked as described. 


Sorry for missing these comments here previously folks! 

I’ve just checked again and it still appears to work correctly. But you’ll need to make sure it’s the File Txt field that’s selected, from the Google Docs search action, in the URL field on the webhook action:
ab4c4eb287e03d29efeb153268336ebb.png
If you select the File field it won’t be able to see the text from the file.

Hope that helps! 🙂


Where to find “'Export Links Plain Text'? @alexdsimoes 


Hey @Dusan 👋

It looks as though the field @alexdsimoes referred to is called Export Links Text Plain not Export Links Plain Text:

8d28ddc816b433dcfcc9181cc173787c.png
When using that field, as they mentioned, you’ll need to add in a Google Drive Add File Sharing Preference action ahead of the Webhooks action. And set it to update the permissions of the file to Anyone on the internet who has the link can view which should ensure that the Webhooks action is able to access the file via that export link.

Do let us know if you run into any further issues on this, keen to ensure you’re all set! 


Reply