Search

Download File

Last Updated: Feb 14, 2022

Articles

Use this function to download a file in Google Drive.

Syntax

Download File (file_id, file_path, private_key, client_email)

Parameters

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

Returns

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

Sample

Download File (XYZ123, C:\Downloads, —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—–, name@project-id.iam.gserviceaccount.com)

  • Uses the private key —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—– to connect to the Email ID name@project-id.iam.gserviceaccount.com, 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?