How can I convert gdocs to text on server side when downloading using gDrive node

Issue/Question

I have a google drive node that i want it to download google documents in text format. The only option is Rich Text Format from the drop down menu for docs, but if i try to set the expression mode to text, txt, or text/plain the google drive node errors out.

Google supports downloading in plain text (command line - How to convert document from Google Docs to text file - Ask Ubuntu) and tested it and worked exactly how i want it to work, and google drive node supports plain text for slides

This is the format for the link to export google doc as text: https://docs.google.com/document/d/FILE_ID/export?format=txt

How can i make the google drive node download a gdoc in plain text?

Error

ERROR: UNKNOWN ERROR - check the detailed error for more information
Converting circular structure to JSON → starting at object with constructor ‘TLSSocket’ | property ‘parser’ → object with constructor ‘HTTPParser’ — property ‘socket’ closes the circle

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at Object.googleApiRequest (/home/waffles/node_modules/n8n-nodes-base/nodes/Google/Drive/GenericFunctions.ts:123:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.execute (/home/waffles/node_modules/n8n-nodes-base/nodes/Google/Drive/GoogleDrive.node.ts:2279:19)
    at Workflow.runNode (/home/waffles/node_modules/n8n-workflow/src/Workflow.ts:1271:19)
    at /home/waffles/node_modules/n8n-core/src/WorkflowExecute.ts:939:29

Workflow

Information on your n8n setup

  • n8n version: 0.212.0 (latest at the time of writing)
  • Running n8n via: npm for development but want to use cloud

Hi @waffles, I think the easiest way to extract plain text from Google Docs could be to just the Google Docs node itself. Using the Get operation would result in a content field with the text content, which you can then convert into a text file like so:

Google Doc:

Text file:

1 Like

@MutedJam I see, seems exactly what i need, but is it possible to do it with google drive node only? thanks for the reply

Hey @waffles,

It looks like if you want the content the docs node is the way to do it as the Google Drive node will try to download the binary data instead of the actual file contents.

@Jon i see, thanks for the reply, that was helpful!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.