Download File

Last Updated: Nov 26, 2021


Use this function to download a file in Google Drive.


Download File (file_id, file_path, private_key, client_email)


Input Parameter Name Description
file_id Id of the folder or file
file_path Path to download the file
private_key Private key of the service account
client_email Email ID of the service account


Return Value Description
  • On Success returns 1, Path of the downloaded file
  • On Failure returns 0, Error Message


Download File (XYZ123, C:\Downloads, —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—–,

  • Uses the private key —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—– to connect to the Email ID, downloads the file with ID XYZ123 to the path C:\Downloads.
    Returns C:\Downloads on downloading the file.

Ensure that Full Control permission is given to Users for the path given. To check this, right-click on the folder and choose the Security option.
Image description

To view all the Google Drive functions, click here.

Did you find what you were looking for?