Download Google Drive Shared Image/File Using Deluge – Complete Guide

Download Google Drive Shared Image/File Using Deluge – Complete Guide

Download Google Drive Shared Image/File Using Deluge – Complete Guide


When working with Google Drive share links inside Deluge, many developers face a common challenge:

👉 How can we download a Google Drive file directly using Deluge?

This article explains how a Google Drive URL works and how to convert it into a direct download link that Deluge can fetch easily.


🔍 Understanding the Google Drive File URL

A standard Google Drive shared link looks like this:

https://drive.google.com/file/d/1h74574g_f7y6B8JxzDmAfgUiC_nd_XcD5bwPF/view?usp=drive_link

From this link:

  • The File ID appears after d/

  • It ends before /view

📌 Extracted File ID:
1h74574g_f7y6B8JxzDmAfgUiC_nd_XcD5bwPF


Converting to a Direct Download Link

Google Drive uses a special format to force direct downloads:

https://drive.google.com/uc?export=download&id=FILE_ID

After inserting the File ID:

➡️ Direct Download URL:
https://drive.google.com/uc?export=download&id=1h74574g_f7y6B8JxzDmAfgUiC_nd_XcD5bwPF

This link can now be used inside Deluge without any issues.


Using the Direct Download Link in Deluge (Static Example)

Below is the static Deluge call (written as plain text):

  1. GetDetails = invokeUrl
  2. [
  3.   url: "https://drive.google.com/uc?export=download&id=1h74574g_f7y6B8JxzDmAfgUiC_nd_XcD5bwPF"
  4.   type: GET
  5. ];

The variable GetDetails will store the downloaded file content.


Dynamic Deluge Code (Recommended Method)

This version automatically extracts the File ID from any valid Google Drive URL and downloads the file.

  1. FileURL = "https://drive.google.com/file/d/1hg_f7y6B8JxzDmAfgUiC_nd_XcD5bwPF/view?usp=drive_link";
  2. FileID = FileURL.getsuffix("d/").getprefix("/");
  3. headermap = Map();
  4. headermap.put("Content-type", "image/jpeg");
  5. GetDetails = invokeUrl
  6. [
  7.   url: "https://drive.google.com/uc?export=download&id=" + FileID
  8.   type: GET
  9. ];
  10. GetDetails.setParamName("file");
  11. GetDetails.setFileName("test.png");

With setFileName, you can generate the file name and format dynamically—PNG, JPG, JPEG, PDF, etc.


By following this method, you can convert any Google Drive shared link into a direct download URL and use it in Deluge anywhere—CRM attachments, WorkDrive storage, or third-party integrations.

💬 If you have any questions or want enhancements, feel free to comment below.
Happy coding! 🚀


Thanks & Regards
Piyush Goyal
Zoho Developer || Zoho CRM and Creator Certified
+91-8619164837 
    • Sticky Posts

    • Function #41: Sync Associated Subforms!

      Welcome back everyone! The last custom function showed how to update a Contact with Product details from it's Related list in Deals. This week, let's look at a function that lets you update subform records in two modules simultaneously when one of them is updated. Business scenario Let's look at how subform helps in an education institution that has deployed Zoho CRM. National Public School, Austin (made up, of course!) has set up Zoho CRM and it follows the same relationship pattern of "Students",