Search

Delete File

Last Updated: May 10, 2022

Articles

Use this function to delete a file in Google Drive.

Syntax

Delete File (id, private_key, client_email)

Parameters

Input Parameter Name Description
id Id of the folder or 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, Selected file/folder deleted successfully
  • On Failure returns 0, Error Message

Sample

Delete File (XYZ123, —–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, deletes the file with ID XYZ123.
    Returns Selected file/folder deleted successfully on deleting the file.

To view all the Google Drive functions, click here.

Did you find what you were looking for?