GoogleDrive_Logo You can upload any type of file to your Google Drive account and, as of this writing, the storage limit is 15GB. After uploading the file, you can set permissions to define who is allowed to also view and download the file. Alternatively, you can create a folder and set permissions on the folder, which defines the permissions for all the files in that folder automatically. The Google Drive link that is provided for the file takes you to a page in Google Drive to view the file and/or download it manually. That’s a useful feature, but sometimes you may want to bypass the built-in viewer and download the file directly.

Direct Download Link for a Google Drive File

To get the direct download link for a Google Drive file, you can go to the Google Drive developers API references and use their “try it!” API explorer form for the get API call. In the fileId field, just paste the file’s ID and click “Execute”. Below under response, in the generated JSON, the direct link that you need is called webContentLink and looks something like this:

Download a Googe Drive File in Java

As part of out Datasets project, we need to download some database files that we have on Google Drive from within Java code. Using the direct link from above along with the org.apache.commons.io.FileUtils class, this can be easily achieved.

Bypassing the Virus Scan Check on Google Drive

Unfortunately, as far as I can tell, this is not possible. There are many posts out there showing how it can be done, but after trying all of them, I’ve come to the conclusion, that Google has disabled this possibilty. As a workaround in our Datasets project, we have built in some logic that directs the client to download the file manually for the files that are too big for Google to run the virus scan on.

Related Posts

Subscribe To Our Newsletter

Join our low volume mailing list to receive the latest news and updates from our team.

4 Comments

    • Vidya
      reply

      This is really very good info.When i tried your method i am able to download a file,but i am getting junk data in that.

      org.apache.commons.io.FileUtils.copyURLToFile(new URL(“https://docs.google.com/a/hiregrid.io/uc?id=0BxTOibOMb3uZQ1ZKUXNSYUNveUk&export=download”), new File(“/home/vidya/Desktop/test.doc”), 5000, 10000);

    • Zipdox
      reply

      Bypassing the Virus Scan Check on Google Drive
      I found a solution. Get the share link, go to it in incognito, click the download link and start downloading it, then go to downloads, disconnect from the internet (turn off WiFi or unplug cable), and click the link under the file name. Now copy that link. That is the direct download link. It worked for me.

    • Steve How
      reply

      To know the process to get the direct download of the link from the google drive then you need to follow the guidelines from the help of the google drive tech help to maintain that.

    • akhgary
      reply

      very nice. doesn’t require google drive API. thank you!

Leave a Comment

Newsletter

Subscribe to our low-volume mailing list to receive important updates and announcements directly in your inbox.