How to get PDF from Google Drive

Hey, good people!

I am building an automation that will allow me to receive PDFs from Google Drive. I have created a simple starting point, but I’m encountering an issue. My current approach involves using a trigger to obtain the file ID, which I then use in the Google Drive Download node to download the PDF. After that, I plan to use the Extract from PDF node to retrieve the text.

The trigger works perfectly; however, the second node (Google Drive Download node) gives me an error: “Error 400: Bad Request.” I’ve included some pictures below to give you a better idea of the situation. The goal is to get the PDF and convert it into text.

Overall:

Trigger Setting:

The Download Node Settings:

Hi @FahadAhmed121027

make sure there is no spaces here:
image

just the expression

There is no space, i double checked it. It is just expression

hmm weird, what about using link?

image

Same things sir, i have also used the HTTP node with this expression but i look like the HTTP node download the whole web page (not PDF)

Is this is working on your side, If yes then i think i need to update my n8n local,

1. Check the File ID Expression

In your Google Drive Download node, make sure you’re referencing the file ID correctly:

  • The trigger outputs the file information in a specific structure

  • Try using: {{ $json.id }} instead of just the file ID field

  • Or check the exact path by looking at the trigger’s output data

To find the correct path:

  1. Run the trigger and let it capture a file

  2. Click on the trigger node to see its output

  3. Look for the file ID field (might be id, fileId, or nested like file.id)

  4. Use that exact path in your Download node

2. Verify File Permissions

The “400 Bad Request” can occur if:

  • The file isn’t actually a PDF (Google Drive might show it as PDF but it’s a Google Doc)

  • Your n8n Google Drive credentials don’t have permission to download the file

  • The file is in a shared drive that requires special access

Solution:

  • Make sure the file is an actual PDF, not a Google Docs file

  • Check that your Google Drive connection has “Read” permissions

3. Use “By URL” Instead of “By ID”

Sometimes the Download node works better with the file URL:

  1. In the Google Drive Download node, switch the selection method to By URL (if available)

  2. Use the file’s webViewLink or webContentLink from the trigger output

1 Like

Yes, it’s working on my side, both by ID and by URL, I think there might be an issue with your file,

From what I can see, this is the link you’re trying to download:

https://drive.google.com/file/d/1YgUz33wWTJZFsULGXM_2fZCuBef4aS7g/view

in your screenshot using the ID 18QFIeQx0aAqoQlOQjwNEemtWQHAtWBov redirects me to that link, which means this ID doesn’t exist anymore,

That likely means the file was deleted and then uploaded again (just a guess idk),

Please double-check the file id and link..

2 Likes

Oh, the problem was that I had a shortcut to the file in the folder, not the actual file.

thanks

1 Like