Google drive download and execute command

Hi there,

I am new to N8N and I search everywhere but didn’t find any solution to my issue
When a pdf file is appearing in my google drive specific folder I am using the node google drive to download the file, but I don’t know where the file is temporary stored.
I create a specific script to transform my pdf in json format and I am using the node execute command to execute the script and get the Json result in the outpout. What I want is to say to my script where to search my google drive pdf whatever the name of this file.

I am using the last version of N8N on npm for windows et docker on linux.

Thanks for your help

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Froldev Welcome to community!

In n8n, when you download a file using the Google Drive node, the file is stored in memory as binary data within the workflow’s context. This means the file isn’t saved to a physical location on your server by default. To process this file with your custom script using the Execute Command node, you’ll need to write the in-memory binary data to a temporary file, execute your script on this file, and then, if necessary, remove the temporary file after processing. Here’s how you can achieve this:

1. Writing the Binary Data to a Temporary File:

Use the “Write Binary File” node to save the in-memory binary data to a temporary location on your filesystem.

  • Add the “Write Binary File” Node:
    • Set the “Binary Property” to the name of the property holding your file (default is data).
    • Specify the “File Path” where you want to save the file, e.g., /tmp/downloaded_file.pdf on Unix-based systems or C:\Temp\downloaded_file.pdf on Windows.

Or you can do that by:
Using the “Extract From File” Node:

n8n offers the “Extract From File” node, which can extract text content from PDF files. Here’s how to set it up:

  • Add the “Extract From File” Node: In your workflow, include this node to process the PDF.
  • Configure the Node:
    • Input Binary Field: Specify the field containing the PDF binary data.
    • Operation: Select “Extract From PDF” to extract text content.

This method is straightforward but primarily extracts plain text, which might require additional parsing to structure as JSON.

1 Like

works like a charm!

Thanks Ruslan

1 Like

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