Search

Create Folder

Last Updated: Mar 8, 2023

Articles

Use this function to create a new folder inside a parent folder.

Syntax

Create Folder (folder_name, parent_folder_id, private_key, client_email)

Parameters

Input Parameter Name Description
folder_name Name of the folder to be created
parent_folder_id Parent folder ID in which the subfolder has to be created
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, Folder ID
  • On Failure returns 0, Error Message

Sample

Create Folder (Invoices, ABC123, —–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, creates a folder Invoice in the parent folder with ID ABC123.
    Returns the Folder ID of the folder created.

To view all the Google Drive functions, click here.

Did you find what you were looking for?