Before you begin
- Connect Google services in Next Matter with a service account and share data with this account. Learn more…
- Check the required scopes to learn more about which data is shared between the apps.
-
Get a Google Drive file ID.
Where is the file / document ID in Google
Open your Google file - it can be a spreadsheet or a document. Copy the value from the URL of your file ( between /d/ and /edit)https://docs.google.com/document/d/143uVKzah2WhnPEHY3ATwM4UM0K-hjvZ3OB_kT93qrQU/edit
-
Get the Google Drive folder ID. You can find it in the folder’s URL, which is
https://drive.google.com/drive/u/0/folders/FOLDER_ID
-
When a file or folder is stored on a Google Shared Drive (as opposed to personal “My Drive” locations), add this parameter:
supportsAllDrives=true
to the request to ensure the API can access and operate on those shared resources.
Check out our ready-made templates available when you add a step and select Templates > 3rd party templates. You can use the templates to create a set of pre-configured steps. Need a specific template? Click the Contact us button in the top right of the page and let us know.
Upload files to process and then Drive
- Create a step to upload a file. To do that, in your workflow add a step that’s a form.
- Click + Add form field and select the File upload as the form field.
- Create the next step to upload the file to Google Drive. Click Settings to configure the step.
-
Enter the following details:
Key Type Value metadata text {"name": "{data reference to the filename of the uploaded file}", "parents":["GDRIVE_FOLDER_ID"]}
key1 file {data reference to the "First File" field from the file upload step}
You can only upload one file from the File Upload step. To upload multiple files, upload them as a .zip.- Method: POST
- URL:
https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart
- Authorization: Google Drive
- Body type: Form-data
- In the Body add the two following rows:
-
If you need the Google Drive file ID of the file to be referenced in later steps, click + Create variable and create a
fileid
reference of the value $id. - Save your changes.
Give access to the file stored in Google Drive to a user
- Create an Integrations > Custom integration step to upload the file.
- Click Settings to configure the step.
-
Enter the following details:
- Method: POST
- URL:
https://www.googleapis.com/drive/v2/files/FILE_ID/permissions?supportsAllDrives=true&includeTeamDriveItems=true&includeItemsFromAllDrives=true
- Authorization: Google Drive
- Headers: Content-Type:
application/json
- In the Body enter the following data:
-
If you need the Google Drive file ID of the file to be referenced in later steps, click + Create variable and create a
fileid
reference of the value $id. - Save your changes.
Copy file stored in Drive
- Create an Integrations > Custom integration step to copy the file.
- Click Settings to configure the step.
-
Enter the following details:
- Method: POST
- URL:
https://www.googleapis.com/drive/v3/filesFILEID_OF_THE_FILE_TO_COPY/copy?supportsAllDrives=True
- Authorization: Google Drive
- Headers: Content-Type:
application/json
- In the Body enter the following data:
-
If you need the Google Drive file ID of the file to be referenced in later steps, click + Create variable and create a
fileid
reference of the value $id. - Save your changes.
Create a Google Drive folder
Before you begin
- Get the Google Drive parent folder ID. You can find it in the folder’s URL, which is
https://drive.google.com/drive/u/0/folders/FOLDER_ID.
The parent folder is the folder in which you’re creating a sub-folder.
- Create an Integrations > Custom integration step.
- Click Settings to configure the step.
-
Enter the following details:
- Method: POST
- URL: `https://www.googleapis.com/drive/v3/files Note that for the request to work, you need to give full access to the parent folder, such as the “Anyone with the link can edit” permission.
- Authorization: Google Drive
- Headers: Content-Type:
application/json
- In the Body enter the following data:
-
If you need the Google Drive file ID of the file to be referenced in later steps, click + Create variable and create a
folderid
reference of the value $id.
- Method: PATCH
- URL:
https://www.googleapis.com/drive/v3/files/FILE_ID?addParents=FOLDER_ID
- Authorization: Google Drive
- Headers: Content-Type:
application/json
- Body is empty
Move a file to a new folder
You can move a file from one folder to another in Google Drive.- In Next Matter, create an Integrations > Custom integration step.
- Click Settings to configure the step.
- Enter the following details:
The file ID and the parent folder ID can also be references to data from previous steps.
- Authorization: Google Drive
- Body is empty.
Replace one file with another
- Create a step to upload a file. To do that, in your workflow add an action step.
- Click + Add action and select the File upload as the action type.
- Create the next step to replace an old file with the uploaded one in Google Drive. Click Settings to configure the step.
-
Enter the following details:
Key Type Value metadata text {"name": "{data reference to the filename of the uploaded file}"}
key1 file {data reference to the uploaded file}
- Method: PUT
- URL:
https://www.googleapis.com/upload/drive/v3/FILE_ID
- Authorization: Google Drive
- Body type: Form-data
- In the Body add the two following rows:
-
If you need the Google Drive file ID of the file to be referenced in later steps, click + Create variable and create a
fileid
reference of the value $id. - Save your changes.