Files
Handles operations on files and folders in Google Drive, such as uploading, modifying metadata, and organizing file structure.
Select
The Files table supports only a subset of columns for filtering. Below is a table containing those columns with their supported operations. All filters can be connected with 'OR' or 'AND' operators.
| Column | Supported Operators |
| Name | contains, =, != |
| MIMEType | contains, =, != |
| ModifiedTime | <=, <, =, !=, >, >= |
| Trashed | =, != |
| Starred | =, != |
| ParentIds | in |
| OwnerEmail | in |
The contains operator only performs prefix matching for a name.
For example, the name "HelloWorld" would match for name contains 'Hello' but not
name contains 'World'.
SELECT * FROM [Files] WHERE ModifiedTime > '2017-01-01' OR CONTAINS(Name, 'CData')
SELECT * FROM [Files] WHERE OwnerEmail IN ('[email protected]') AND Starred = true
SELECT * FROM [Files] WHERE Starred = true
SELECT * FROM [Files] WHERE DriveId = '0ACkq0ZiV0yJCUk9PVA'Note: You must set the connection property SupportsAllDrives to 'true', in order to query from a specific Drive.
Insert
You must specify values at least for Name and one of LocalFile or FileData.
INSERT INTO Files (Name, LocalFile) VALUES ('MyFile', 'C:\\\\file.txt')
Update
Id is required for updating a File.
UPDATE Files SET Name = 'UpdatedName' WHERE Id = '19YFv8wmvKixCYaJJAeE8jN3ROt7x1ZicvXwflswVOrw'
Also the content of the file can be updated. Note that this will replace the actual content.
UPDATE Files SET LocalFile = 'C:\\\\file.txt' WHERE Id = '19YFv8wmvKixCYaJJAeE8jN3ROt7x1ZicvXwflswVOrw'
Delete
To delete a File, the Id is required.
DELETE FROM [Files] WHERE Id = '1Dx6GTyhgTmTjtoy8GuG0n0qaOsKyhwrOG6MG8A2QQYA'
Columns
| Name | Type | ReadOnly | Description |
| Id [KEY] | String | True |
The unique identifier assigned to the file in Google Drive. |
| Name | String | False |
The display name of the file. This name does not need to be unique within a folder. Items such as the root folder of My Drive, Team Drive roots, and the Application Data folder have fixed names. |
| DriveId | String | True |
The identifier of the personal or shared drive that contains the file. |
| Description | String | False |
A user-defined summary describing the purpose or contents of the file or folder. |
| Extension | String | True |
The file extension that reflects its format, such as pdf, csv, or jpg. |
| MIMEType | String | False |
The Multipurpose Internet Mail Extensions (MIME) type of the file, such as application/pdf or image/jpeg, indicating the file's format. |
| CreatedTime | Datetime | True |
The timestamp when the file or folder was first created in Google Drive. |
| ModifiedTime | Datetime | True |
The timestamp of the most recent change made to the file or folder. |
| Size | Long | True |
The total size of the file in bytes. This does not apply to folders or native Google Workspace files. |
| OwnerName | String | True |
The full name of the user who owns the file or folder. |
| OwnerEmail | String | True |
The email address of the owner of the file or folder. |
| Folder | Boolean | True |
If the value is 'true', the resource is a folder. If 'false', it is a file. |
| Starred | Boolean | False |
If the value is 'true', the resource is marked as starred by the user. |
| Trashed | Boolean | True |
If the value is 'true', the resource has been moved to the trash. |
| Viewed | Boolean | True |
If the value is 'true', the file or folder has been opened or previewed by the authenticated user. |
| ParentIds | String | True |
A comma-separated list of folder IDs, such as abc123, def456, ghi789, that act as parent directories of the file. |
| ChildIds | String | True |
A semicolon-separated list of resource identifiers, such as file123; file456; file789, that represent the children of this folder. |
| ChildLinks | String | True |
A semicolon-separated list of links, such as https://drive.google.com/file1; https://drive.google.com/file2, that point to the child resources. |
| Query | String | True |
Accepts a custom query string using the Google Drive Software Development Kit (SDK) language. Overrides any conditions defined in the WHERE clause. |
| LocalFile | String | False |
The full path and name of the file to upload from the local system. This is required when FileData is not used. Applicable only when inserting or updating a file. |
| FileData | String | False |
Contains the encoded file content to be uploaded when LocalFile is not specified. Applicable only when inserting or updating a file. |
| Encoding | String | False |
Defines the encoding type of the FileData input, used during file insertion or update. The allowed values are NONE, BASE64. The default value is BASE64. |