Skip to main content

files

Creates, updates, deletes, gets or lists a files resource.

Overview

Namefiles
TypeResource
Idgoogleworkspace.drivev2.files

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the file.
alternateLinkstringOutput only. A link for opening the file in a relevant Google editor or viewer.
appDataContentsbooleanOutput only. Whether this file is in the Application Data folder.
canCommentbooleanOutput only. Deprecated: Use capabilities/canComment instead.
canReadRevisionsbooleanOutput only. Deprecated: Use capabilities/canReadRevisions instead.
capabilitiesobjectOutput only. Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take.
contentRestrictionsarrayRestrictions for accessing the content of the file. Only populated if such a restriction exists.
copyRequiresWriterPermissionbooleanWhether the options to copy, print, or download this file, should be disabled for readers and commenters.
copyablebooleanOutput only. Deprecated: Use capabilities/canCopy instead.
createdDatestring (date-time)Create time for this file (formatted RFC 3339 timestamp).
defaultOpenWithLinkstringOutput only. A link to open this file with the user's default app for this file. Only populated when the drive.apps.readonly scope is used.
descriptionstringA short description of the file.
downloadUrlstringOutput only. Short lived download URL for the file. This field is only populated for files with content stored in Google Drive; it is not populated for Google Docs or shortcut files.
driveIdstringOutput only. ID of the shared drive the file resides in. Only populated for items in shared drives.
editablebooleanOutput only. Deprecated: Use capabilities/canEdit instead.
embedLinkstringOutput only. A link for embedding the file.
etagstringOutput only. ETag of the file.
explicitlyTrashedbooleanOutput only. Whether this file has been explicitly trashed, as opposed to recursively trashed.
exportLinksobjectOutput only. Links for exporting Docs Editors files to specific formats.
fileExtensionstringOutput only. The final component of fullFileExtension with trailing text that does not appear to be part of the extension removed. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
fileSizestring (int64)Output only. Size in bytes of blobs and first party editor files. Won't be populated for files that have no size, like shortcuts and folders.
folderColorRgbstringFolder color as an RGB hex string if the file is a folder or a shortcut to a folder. The list of supported colors is available in the folderColorPalette field of the About resource. If an unsupported color is specified, it will be changed to the closest color in the palette.
fullFileExtensionstringOutput only. The full file extension; extracted from the title. May contain multiple concatenated extensions, such as "tar.gz". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
hasAugmentedPermissionsbooleanOutput only. Whether there are permissions directly on this file. This field is only populated for items in shared drives.
hasThumbnailbooleanOutput only. Whether this file has a thumbnail. This does not indicate whether the requesting app has access to the thumbnail. To check access, look for the presence of the thumbnailLink field.
headRevisionIdstringOutput only. The ID of the file's head revision. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
iconLinkstringOutput only. A link to the file's icon.
imageMediaMetadataobjectOutput only. Metadata about image media. This will only be present for image types, and its contents will depend on what can be parsed from the image content.
indexableTextobjectIndexable text attributes for the file (can only be written)
inheritedPermissionsDisabledbooleanWhether this file has inherited permissions disabled. Inherited permissions are enabled by default.
isAppAuthorizedbooleanOutput only. Whether the file was created or opened by the requesting app.
kindstringOutput only. The type of file. This is always drive#file. (default: drive#file)
labelInfoobjectOutput only. An overview of the labels on the file.
labelsobjectA group of labels for the file.
lastModifyingUserobjectOutput only. The last user to modify this file. This field is only populated when the last modification was performed by a signed-in user. (id: User)
lastModifyingUserNamestringOutput only. Name of the last user to modify this file.
lastViewedByMeDatestring (date-time)Last time this file was viewed by the user (formatted RFC 3339 timestamp).
linkShareMetadataobjectContains details about the link URLs that clients are using to refer to this item.
markedViewedByMeDatestring (date-time)Deprecated.
md5ChecksumstringOutput only. An MD5 checksum for the content of this file. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
mimeTypestringThe MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type.
modifiedByMeDatestring (date-time)Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date.
modifiedDatestring (date-time)Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set.
openWithLinksobjectOutput only. A map of the id of each of the user's apps to a link to open this file with that app. Only populated when the drive.apps.readonly scope is used.
originalFilenamestringThe original filename of the uploaded content if available, or else the original value of the title field. This is only available for files with binary content in Google Drive.
ownedByMebooleanOutput only. Whether the file is owned by the current user. Not populated for items in shared drives.
ownerNamesarrayOutput only. Name(s) of the owner(s) of this file. Not populated for items in shared drives.
ownersarrayOutput only. The owner of this file. Only certain legacy files may have more than one owner. This field isn't populated for items in shared drives.
parentsarrayThe ID of the parent folder containing the file. A file can only have one parent folder; specifying multiple parents isn't supported. If not specified as part of an insert request, the file is placed directly in the user's My Drive folder. If not specified as part of a copy request, the file inherits any discoverable parent of the source file. Update requests must use the addParents and removeParents parameters to modify the parents list.
permissionIdsarrayOutput only. List of permission IDs for users with access to this file.
permissionsarrayOutput only. The list of permissions for users with access to this file. Not populated for items in shared drives.
propertiesarrayThe list of properties.
quotaBytesUsedstring (int64)Output only. The number of quota bytes used by this file.
resourceKeystringOutput only. A key needed to access the item via a shared link.
selfLinkstringOutput only. A link back to this file.
sha1ChecksumstringOutput only. The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
sha256ChecksumstringOutput only. The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
shareablebooleanOutput only. Deprecated: Use capabilities/canShare instead.
sharedbooleanOutput only. Whether the file has been shared. Not populated for items in shared drives.
sharedWithMeDatestring (date-time)Time at which this file was shared with the user (formatted RFC 3339 timestamp).
sharingUserobjectInformation about a Drive user. (id: User)
shortcutDetailsobjectShortcut file details. Only populated for shortcut files, which have the mimeType field set to application/vnd.google-apps.shortcut. Can only be set on files.insert requests.
spacesarrayOutput only. The list of spaces which contain the file. Supported values are drive, appDataFolder and photos.
teamDriveIdstringOutput only. Deprecated: Use driveId instead.
thumbnailobjectA thumbnail for the file. This will only be used if a standard thumbnail cannot be generated.
thumbnailLinkstringOutput only. A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Not intended for direct usage on web applications due to Cross-Origin Resource Sharing (CORS), consider using a proxy server. Only populated when the requesting app can access the file's content. If the file isn't shared publicly, the URL returned in Files.thumbnailLink must be fetched using a credentialed request.
thumbnailVersionstring (int64)Output only. The thumbnail version for use in thumbnail cache invalidation.
titlestringThe title of this file. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the title is constant.
trashedDatestring (date-time)The time that the item was trashed (formatted RFC 3339 timestamp). Only populated for items in shared drives.
trashingUserobjectInformation about a Drive user. (id: User)
userPermissionobjectOutput only. The permissions for the authenticated user on this file. (id: Permission)
versionstring (int64)Output only. A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the requesting user.
videoMediaMetadataobjectOutput only. Metadata about video media. This will only be present for video types.
webContentLinkstringOutput only. A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials.
webViewLinkstringOutput only. A link only available on public folders for viewing their static web assets (HTML, CSS, JS, etc) via Google Drive's Website Hosting.
writersCanSharebooleanWhether writers can share the document with other users. Not populated for items in shared drives.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileIdacknowledgeAbuse, projection, revisionId, supportsAllDrives, supportsTeamDrives, updateViewedDate, includePermissionsForView, includeLabels Gets a file's metadata or content by ID. If you provide the URL parameter alt=media, then the response includes the file contents in the response body. Downloading content with alt=media only works if the file is stored in Drive. To download Google Docs, Sheets, and Slides use files.export instead. For more information, see Download & export files.
listselectcorpora, corpus, driveId, includeItemsFromAllDrives, includeTeamDriveItems, maxResults, orderBy, pageToken, projection, q, spaces, supportsAllDrives, supportsTeamDrives, teamDriveId, includePermissionsForView, includeLabels Lists the user's files. This method accepts the q parameter, which is a search query combining one or more search terms. For more information, see the Search for files & folders guide. Note: This method returns all files by default, including trashed files. If you don't want trashed files to appear in the list, use the trashed=false query parameter to remove trashed files from the results.
insertinsertconvert, enforceSingleParent, ocr, ocrLanguage, pinned, supportsAllDrives, supportsTeamDrives, timedTextLanguage, timedTextTrackName, useContentAsIndexableText, visibility, includePermissionsForView, includeLabels Inserts a new file. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/* Note: Specify a valid MIME type, rather than the literal */* value. The literal */* is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data. Apps creating shortcuts with files.insert must specify the MIME type application/vnd.google-apps.shortcut. Apps should specify a file extension in the title property when inserting files with the API. For example, an operation to insert a JPEG file should specify something like "title": "cat.jpg" in the metadata. Subsequent GET requests include the read-only fileExtension property populated with the extension originally specified in the title property. When a Google Drive user requests to download a file, or when the file is downloaded through the sync client, Drive builds a full filename (with extension) based on the title. In cases where the extension is missing, Drive attempts to determine the extension based on the file's MIME type.
patchupdatefileIdaddParents, convert, enforceSingleParent, modifiedDateBehavior, newRevision, ocr, ocrLanguage, pinned, removeParents, setModifiedDate, supportsAllDrives, supportsTeamDrives, timedTextLanguage, timedTextTrackName, updateViewedDate, useContentAsIndexableText, includePermissionsForView, includeLabelsUpdates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might change automatically, such as modifiedDate. This method supports patch semantics.
updatereplacefileIdaddParents, convert, enforceSingleParent, modifiedDateBehavior, newRevision, ocr, ocrLanguage, pinned, removeParents, setModifiedDate, supportsAllDrives, supportsTeamDrives, timedTextLanguage, timedTextTrackName, updateViewedDate, useContentAsIndexableText, includePermissionsForView, includeLabels Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might be changed automatically, such as modifiedDate. This method supports patch semantics. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/* Note: Specify a valid MIME type, rather than the literal */* value. The literal */* is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data.
deletedeletefileIdsupportsAllDrives, supportsTeamDrives, enforceSingleParentPermanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive, the user must be an organizer on the parent folder. If the target is a folder, all descendants owned by the user are also deleted.
copyexecfileIdconvert, enforceSingleParent, ocr, ocrLanguage, pinned, supportsAllDrives, supportsTeamDrives, timedTextLanguage, timedTextTrackName, visibility, includePermissionsForView, includeLabelsCreates a copy of the specified file.
empty_trashexecenforceSingleParent, driveIdPermanently deletes all of the user's trashed files.
exportexecfileId, mimeTypeExports a Google Workspace document to the requested MIME type and returns exported byte content. Note that the exported content is limited to 10MB.
generate_idsexecmaxResults, space, typeGenerates a set of file IDs which can be provided in insert or copy requests.
modify_labelsexecfileIdModifies the set of labels applied to a file. Returns a list of the labels that were added or modified.
touchexecfileIdsupportsAllDrives, supportsTeamDrives, includePermissionsForView, includeLabelsSet the file's updated time to the current server time.
trashexecfileIdsupportsAllDrives, supportsTeamDrives, includePermissionsForView, includeLabelsMoves a file to the trash. The currently authenticated user must own the file or be at least a fileOrganizer on the parent for shared drive files.
untrashexecfileIdsupportsAllDrives, supportsTeamDrives, includePermissionsForView, includeLabelsRestores a file from the trash. The currently authenticated user must own the file or be at least a fileOrganizer on the parent for shared drive files.
watchexecfileIdsupportsAllDrives, supportsTeamDrives, acknowledgeAbuse, includePermissionsForView, revisionId, updateViewedDate, projection, includeLabelsSubscribes to changes to a file.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
fileIdstring
mimeTypestring
acknowledgeAbuseboolean
addParentsstring
convertboolean
corporastring
corpusstring
driveIdstring
enforceSingleParentboolean
includeItemsFromAllDrivesboolean
includeLabelsstring
includePermissionsForViewstring
includeTeamDriveItemsboolean
maxResultsinteger (int32)
modifiedDateBehaviorstring
newRevisionboolean
ocrboolean
ocrLanguagestring
orderBystring
pageTokenstring
pinnedboolean
projectionstring
qstring
removeParentsstring
revisionIdstring
setModifiedDateboolean
spacestring
spacesstring
supportsAllDrivesboolean
supportsTeamDrivesboolean
teamDriveIdstring
timedTextLanguagestring
timedTextTrackNamestring
typestring
updateViewedDateboolean
useContentAsIndexableTextboolean
visibilitystring

SELECT examples

Gets a file's metadata or content by ID. If you provide the URL parameter alt=media, then the response includes the file contents in the response body. Downloading content with alt=media only works if the file is stored in Drive. To download Google Docs, Sheets, and Slides use files.export instead. For more information, see Download & export files.

SELECT
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare
FROM googleworkspace.drivev2.files
WHERE fileId = '{{ fileId }}' -- required
AND acknowledgeAbuse = '{{ acknowledgeAbuse }}'
AND projection = '{{ projection }}'
AND revisionId = '{{ revisionId }}'
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND updateViewedDate = '{{ updateViewedDate }}'
AND includePermissionsForView = '{{ includePermissionsForView }}'
AND includeLabels = '{{ includeLabels }}'
;

INSERT examples

Inserts a new file. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/* Note: Specify a valid MIME type, rather than the literal */* value. The literal */* is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data. Apps creating shortcuts with files.insert must specify the MIME type application/vnd.google-apps.shortcut. Apps should specify a file extension in the title property when inserting files with the API. For example, an operation to insert a JPEG file should specify something like "title": "cat.jpg" in the metadata. Subsequent GET requests include the read-only fileExtension property populated with the extension originally specified in the title property. When a Google Drive user requests to download a file, or when the file is downloaded through the sync client, Drive builds a full filename (with extension) based on the title. In cases where the extension is missing, Drive attempts to determine the extension based on the file's MIME type.

INSERT INTO googleworkspace.drivev2.files (
data__kind,
data__userPermission,
data__fileExtension,
data__md5Checksum,
data__selfLink,
data__ownerNames,
data__lastModifyingUserName,
data__editable,
data__writersCanShare,
data__downloadUrl,
data__mimeType,
data__driveId,
data__parents,
data__thumbnailLink,
data__appDataContents,
data__webViewLink,
data__iconLink,
data__shared,
data__lastModifyingUser,
data__owners,
data__openWithLinks,
data__defaultOpenWithLink,
data__headRevisionId,
data__properties,
data__copyable,
data__etag,
data__sharingUser,
data__alternateLink,
data__embedLink,
data__webContentLink,
data__fileSize,
data__copyRequiresWriterPermission,
data__permissions,
data__hasThumbnail,
data__spaces,
data__folderColorRgb,
data__id,
data__title,
data__description,
data__labels,
data__explicitlyTrashed,
data__createdDate,
data__modifiedDate,
data__modifiedByMeDate,
data__lastViewedByMeDate,
data__markedViewedByMeDate,
data__sharedWithMeDate,
data__quotaBytesUsed,
data__version,
data__indexableText,
data__originalFilename,
data__ownedByMe,
data__canComment,
data__shareable,
data__fullFileExtension,
data__isAppAuthorized,
data__teamDriveId,
data__capabilities,
data__hasAugmentedPermissions,
data__trashingUser,
data__canReadRevisions,
data__thumbnailVersion,
data__trashedDate,
data__permissionIds,
data__thumbnail,
data__imageMediaMetadata,
data__videoMediaMetadata,
data__shortcutDetails,
data__contentRestrictions,
data__resourceKey,
data__linkShareMetadata,
data__labelInfo,
data__sha1Checksum,
data__sha256Checksum,
data__inheritedPermissionsDisabled,
convert,
enforceSingleParent,
ocr,
ocrLanguage,
pinned,
supportsAllDrives,
supportsTeamDrives,
timedTextLanguage,
timedTextTrackName,
useContentAsIndexableText,
visibility,
includePermissionsForView,
includeLabels
)
SELECT
'{{ kind }}',
'{{ userPermission }}',
'{{ fileExtension }}',
'{{ md5Checksum }}',
'{{ selfLink }}',
'{{ ownerNames }}',
'{{ lastModifyingUserName }}',
{{ editable }},
{{ writersCanShare }},
'{{ downloadUrl }}',
'{{ mimeType }}',
'{{ driveId }}',
'{{ parents }}',
'{{ thumbnailLink }}',
{{ appDataContents }},
'{{ webViewLink }}',
'{{ iconLink }}',
{{ shared }},
'{{ lastModifyingUser }}',
'{{ owners }}',
'{{ openWithLinks }}',
'{{ defaultOpenWithLink }}',
'{{ headRevisionId }}',
'{{ properties }}',
{{ copyable }},
'{{ etag }}',
'{{ sharingUser }}',
'{{ alternateLink }}',
'{{ embedLink }}',
'{{ webContentLink }}',
'{{ fileSize }}',
{{ copyRequiresWriterPermission }},
'{{ permissions }}',
{{ hasThumbnail }},
'{{ spaces }}',
'{{ folderColorRgb }}',
'{{ id }}',
'{{ title }}',
'{{ description }}',
'{{ labels }}',
{{ explicitlyTrashed }},
'{{ createdDate }}',
'{{ modifiedDate }}',
'{{ modifiedByMeDate }}',
'{{ lastViewedByMeDate }}',
'{{ markedViewedByMeDate }}',
'{{ sharedWithMeDate }}',
'{{ quotaBytesUsed }}',
'{{ version }}',
'{{ indexableText }}',
'{{ originalFilename }}',
{{ ownedByMe }},
{{ canComment }},
{{ shareable }},
'{{ fullFileExtension }}',
{{ isAppAuthorized }},
'{{ teamDriveId }}',
'{{ capabilities }}',
{{ hasAugmentedPermissions }},
'{{ trashingUser }}',
{{ canReadRevisions }},
'{{ thumbnailVersion }}',
'{{ trashedDate }}',
'{{ permissionIds }}',
'{{ thumbnail }}',
'{{ imageMediaMetadata }}',
'{{ videoMediaMetadata }}',
'{{ shortcutDetails }}',
'{{ contentRestrictions }}',
'{{ resourceKey }}',
'{{ linkShareMetadata }}',
'{{ labelInfo }}',
'{{ sha1Checksum }}',
'{{ sha256Checksum }}',
{{ inheritedPermissionsDisabled }},
'{{ convert }}',
'{{ enforceSingleParent }}',
'{{ ocr }}',
'{{ ocrLanguage }}',
'{{ pinned }}',
'{{ supportsAllDrives }}',
'{{ supportsTeamDrives }}',
'{{ timedTextLanguage }}',
'{{ timedTextTrackName }}',
'{{ useContentAsIndexableText }}',
'{{ visibility }}',
'{{ includePermissionsForView }}',
'{{ includeLabels }}'
RETURNING
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare
;

UPDATE examples

Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might change automatically, such as modifiedDate. This method supports patch semantics.

UPDATE googleworkspace.drivev2.files
SET
data__kind = '{{ kind }}',
data__userPermission = '{{ userPermission }}',
data__fileExtension = '{{ fileExtension }}',
data__md5Checksum = '{{ md5Checksum }}',
data__selfLink = '{{ selfLink }}',
data__ownerNames = '{{ ownerNames }}',
data__lastModifyingUserName = '{{ lastModifyingUserName }}',
data__editable = {{ editable }},
data__writersCanShare = {{ writersCanShare }},
data__downloadUrl = '{{ downloadUrl }}',
data__mimeType = '{{ mimeType }}',
data__driveId = '{{ driveId }}',
data__parents = '{{ parents }}',
data__thumbnailLink = '{{ thumbnailLink }}',
data__appDataContents = {{ appDataContents }},
data__webViewLink = '{{ webViewLink }}',
data__iconLink = '{{ iconLink }}',
data__shared = {{ shared }},
data__lastModifyingUser = '{{ lastModifyingUser }}',
data__owners = '{{ owners }}',
data__openWithLinks = '{{ openWithLinks }}',
data__defaultOpenWithLink = '{{ defaultOpenWithLink }}',
data__headRevisionId = '{{ headRevisionId }}',
data__properties = '{{ properties }}',
data__copyable = {{ copyable }},
data__etag = '{{ etag }}',
data__sharingUser = '{{ sharingUser }}',
data__alternateLink = '{{ alternateLink }}',
data__embedLink = '{{ embedLink }}',
data__webContentLink = '{{ webContentLink }}',
data__fileSize = '{{ fileSize }}',
data__copyRequiresWriterPermission = {{ copyRequiresWriterPermission }},
data__permissions = '{{ permissions }}',
data__hasThumbnail = {{ hasThumbnail }},
data__spaces = '{{ spaces }}',
data__folderColorRgb = '{{ folderColorRgb }}',
data__id = '{{ id }}',
data__title = '{{ title }}',
data__description = '{{ description }}',
data__labels = '{{ labels }}',
data__explicitlyTrashed = {{ explicitlyTrashed }},
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__modifiedByMeDate = '{{ modifiedByMeDate }}',
data__lastViewedByMeDate = '{{ lastViewedByMeDate }}',
data__markedViewedByMeDate = '{{ markedViewedByMeDate }}',
data__sharedWithMeDate = '{{ sharedWithMeDate }}',
data__quotaBytesUsed = '{{ quotaBytesUsed }}',
data__version = '{{ version }}',
data__indexableText = '{{ indexableText }}',
data__originalFilename = '{{ originalFilename }}',
data__ownedByMe = {{ ownedByMe }},
data__canComment = {{ canComment }},
data__shareable = {{ shareable }},
data__fullFileExtension = '{{ fullFileExtension }}',
data__isAppAuthorized = {{ isAppAuthorized }},
data__teamDriveId = '{{ teamDriveId }}',
data__capabilities = '{{ capabilities }}',
data__hasAugmentedPermissions = {{ hasAugmentedPermissions }},
data__trashingUser = '{{ trashingUser }}',
data__canReadRevisions = {{ canReadRevisions }},
data__thumbnailVersion = '{{ thumbnailVersion }}',
data__trashedDate = '{{ trashedDate }}',
data__permissionIds = '{{ permissionIds }}',
data__thumbnail = '{{ thumbnail }}',
data__imageMediaMetadata = '{{ imageMediaMetadata }}',
data__videoMediaMetadata = '{{ videoMediaMetadata }}',
data__shortcutDetails = '{{ shortcutDetails }}',
data__contentRestrictions = '{{ contentRestrictions }}',
data__resourceKey = '{{ resourceKey }}',
data__linkShareMetadata = '{{ linkShareMetadata }}',
data__labelInfo = '{{ labelInfo }}',
data__sha1Checksum = '{{ sha1Checksum }}',
data__sha256Checksum = '{{ sha256Checksum }}',
data__inheritedPermissionsDisabled = {{ inheritedPermissionsDisabled }}
WHERE
fileId = '{{ fileId }}' --required
AND addParents = '{{ addParents}}'
AND convert = {{ convert}}
AND enforceSingleParent = {{ enforceSingleParent}}
AND modifiedDateBehavior = '{{ modifiedDateBehavior}}'
AND newRevision = {{ newRevision}}
AND ocr = {{ ocr}}
AND ocrLanguage = '{{ ocrLanguage}}'
AND pinned = {{ pinned}}
AND removeParents = '{{ removeParents}}'
AND setModifiedDate = {{ setModifiedDate}}
AND supportsAllDrives = {{ supportsAllDrives}}
AND supportsTeamDrives = {{ supportsTeamDrives}}
AND timedTextLanguage = '{{ timedTextLanguage}}'
AND timedTextTrackName = '{{ timedTextTrackName}}'
AND updateViewedDate = {{ updateViewedDate}}
AND useContentAsIndexableText = {{ useContentAsIndexableText}}
AND includePermissionsForView = '{{ includePermissionsForView}}'
AND includeLabels = '{{ includeLabels}}'
RETURNING
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare;

REPLACE examples

Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might be changed automatically, such as modifiedDate. This method supports patch semantics. This method supports an /upload URI and accepts uploaded media with the following characteristics: - Maximum file size: 5,120 GB - Accepted Media MIME types:*/* Note: Specify a valid MIME type, rather than the literal */* value. The literal */* is only used to indicate that any valid MIME type can be uploaded. For more information on uploading files, see Upload file data.

REPLACE googleworkspace.drivev2.files
SET
data__kind = '{{ kind }}',
data__userPermission = '{{ userPermission }}',
data__fileExtension = '{{ fileExtension }}',
data__md5Checksum = '{{ md5Checksum }}',
data__selfLink = '{{ selfLink }}',
data__ownerNames = '{{ ownerNames }}',
data__lastModifyingUserName = '{{ lastModifyingUserName }}',
data__editable = {{ editable }},
data__writersCanShare = {{ writersCanShare }},
data__downloadUrl = '{{ downloadUrl }}',
data__mimeType = '{{ mimeType }}',
data__driveId = '{{ driveId }}',
data__parents = '{{ parents }}',
data__thumbnailLink = '{{ thumbnailLink }}',
data__appDataContents = {{ appDataContents }},
data__webViewLink = '{{ webViewLink }}',
data__iconLink = '{{ iconLink }}',
data__shared = {{ shared }},
data__lastModifyingUser = '{{ lastModifyingUser }}',
data__owners = '{{ owners }}',
data__openWithLinks = '{{ openWithLinks }}',
data__defaultOpenWithLink = '{{ defaultOpenWithLink }}',
data__headRevisionId = '{{ headRevisionId }}',
data__properties = '{{ properties }}',
data__copyable = {{ copyable }},
data__etag = '{{ etag }}',
data__sharingUser = '{{ sharingUser }}',
data__alternateLink = '{{ alternateLink }}',
data__embedLink = '{{ embedLink }}',
data__webContentLink = '{{ webContentLink }}',
data__fileSize = '{{ fileSize }}',
data__copyRequiresWriterPermission = {{ copyRequiresWriterPermission }},
data__permissions = '{{ permissions }}',
data__hasThumbnail = {{ hasThumbnail }},
data__spaces = '{{ spaces }}',
data__folderColorRgb = '{{ folderColorRgb }}',
data__id = '{{ id }}',
data__title = '{{ title }}',
data__description = '{{ description }}',
data__labels = '{{ labels }}',
data__explicitlyTrashed = {{ explicitlyTrashed }},
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__modifiedByMeDate = '{{ modifiedByMeDate }}',
data__lastViewedByMeDate = '{{ lastViewedByMeDate }}',
data__markedViewedByMeDate = '{{ markedViewedByMeDate }}',
data__sharedWithMeDate = '{{ sharedWithMeDate }}',
data__quotaBytesUsed = '{{ quotaBytesUsed }}',
data__version = '{{ version }}',
data__indexableText = '{{ indexableText }}',
data__originalFilename = '{{ originalFilename }}',
data__ownedByMe = {{ ownedByMe }},
data__canComment = {{ canComment }},
data__shareable = {{ shareable }},
data__fullFileExtension = '{{ fullFileExtension }}',
data__isAppAuthorized = {{ isAppAuthorized }},
data__teamDriveId = '{{ teamDriveId }}',
data__capabilities = '{{ capabilities }}',
data__hasAugmentedPermissions = {{ hasAugmentedPermissions }},
data__trashingUser = '{{ trashingUser }}',
data__canReadRevisions = {{ canReadRevisions }},
data__thumbnailVersion = '{{ thumbnailVersion }}',
data__trashedDate = '{{ trashedDate }}',
data__permissionIds = '{{ permissionIds }}',
data__thumbnail = '{{ thumbnail }}',
data__imageMediaMetadata = '{{ imageMediaMetadata }}',
data__videoMediaMetadata = '{{ videoMediaMetadata }}',
data__shortcutDetails = '{{ shortcutDetails }}',
data__contentRestrictions = '{{ contentRestrictions }}',
data__resourceKey = '{{ resourceKey }}',
data__linkShareMetadata = '{{ linkShareMetadata }}',
data__labelInfo = '{{ labelInfo }}',
data__sha1Checksum = '{{ sha1Checksum }}',
data__sha256Checksum = '{{ sha256Checksum }}',
data__inheritedPermissionsDisabled = {{ inheritedPermissionsDisabled }}
WHERE
fileId = '{{ fileId }}' --required
AND addParents = '{{ addParents}}'
AND convert = {{ convert}}
AND enforceSingleParent = {{ enforceSingleParent}}
AND modifiedDateBehavior = '{{ modifiedDateBehavior}}'
AND newRevision = {{ newRevision}}
AND ocr = {{ ocr}}
AND ocrLanguage = '{{ ocrLanguage}}'
AND pinned = {{ pinned}}
AND removeParents = '{{ removeParents}}'
AND setModifiedDate = {{ setModifiedDate}}
AND supportsAllDrives = {{ supportsAllDrives}}
AND supportsTeamDrives = {{ supportsTeamDrives}}
AND timedTextLanguage = '{{ timedTextLanguage}}'
AND timedTextTrackName = '{{ timedTextTrackName}}'
AND updateViewedDate = {{ updateViewedDate}}
AND useContentAsIndexableText = {{ useContentAsIndexableText}}
AND includePermissionsForView = '{{ includePermissionsForView}}'
AND includeLabels = '{{ includeLabels}}'
RETURNING
id,
alternateLink,
appDataContents,
canComment,
canReadRevisions,
capabilities,
contentRestrictions,
copyRequiresWriterPermission,
copyable,
createdDate,
defaultOpenWithLink,
description,
downloadUrl,
driveId,
editable,
embedLink,
etag,
explicitlyTrashed,
exportLinks,
fileExtension,
fileSize,
folderColorRgb,
fullFileExtension,
hasAugmentedPermissions,
hasThumbnail,
headRevisionId,
iconLink,
imageMediaMetadata,
indexableText,
inheritedPermissionsDisabled,
isAppAuthorized,
kind,
labelInfo,
labels,
lastModifyingUser,
lastModifyingUserName,
lastViewedByMeDate,
linkShareMetadata,
markedViewedByMeDate,
md5Checksum,
mimeType,
modifiedByMeDate,
modifiedDate,
openWithLinks,
originalFilename,
ownedByMe,
ownerNames,
owners,
parents,
permissionIds,
permissions,
properties,
quotaBytesUsed,
resourceKey,
selfLink,
sha1Checksum,
sha256Checksum,
shareable,
shared,
sharedWithMeDate,
sharingUser,
shortcutDetails,
spaces,
teamDriveId,
thumbnail,
thumbnailLink,
thumbnailVersion,
title,
trashedDate,
trashingUser,
userPermission,
version,
videoMediaMetadata,
webContentLink,
webViewLink,
writersCanShare;

DELETE examples

Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive, the user must be an organizer on the parent folder. If the target is a folder, all descendants owned by the user are also deleted.

DELETE FROM googleworkspace.drivev2.files
WHERE fileId = '{{ fileId }}' --required
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND enforceSingleParent = '{{ enforceSingleParent }}'
;

Lifecycle Methods

Creates a copy of the specified file.

EXEC googleworkspace.drivev2.files.copy 
@fileId='{{ fileId }}' --required,
@convert={{ convert }},
@enforceSingleParent={{ enforceSingleParent }},
@ocr={{ ocr }},
@ocrLanguage='{{ ocrLanguage }}',
@pinned={{ pinned }},
@supportsAllDrives={{ supportsAllDrives }},
@supportsTeamDrives={{ supportsTeamDrives }},
@timedTextLanguage='{{ timedTextLanguage }}',
@timedTextTrackName='{{ timedTextTrackName }}',
@visibility='{{ visibility }}',
@includePermissionsForView='{{ includePermissionsForView }}',
@includeLabels='{{ includeLabels }}'
@@json=
'{
"kind": "{{ kind }}",
"userPermission": "{{ userPermission }}",
"fileExtension": "{{ fileExtension }}",
"md5Checksum": "{{ md5Checksum }}",
"selfLink": "{{ selfLink }}",
"ownerNames": "{{ ownerNames }}",
"lastModifyingUserName": "{{ lastModifyingUserName }}",
"editable": {{ editable }},
"writersCanShare": {{ writersCanShare }},
"downloadUrl": "{{ downloadUrl }}",
"mimeType": "{{ mimeType }}",
"driveId": "{{ driveId }}",
"parents": "{{ parents }}",
"thumbnailLink": "{{ thumbnailLink }}",
"appDataContents": {{ appDataContents }},
"webViewLink": "{{ webViewLink }}",
"iconLink": "{{ iconLink }}",
"shared": {{ shared }},
"lastModifyingUser": "{{ lastModifyingUser }}",
"owners": "{{ owners }}",
"openWithLinks": "{{ openWithLinks }}",
"defaultOpenWithLink": "{{ defaultOpenWithLink }}",
"headRevisionId": "{{ headRevisionId }}",
"properties": "{{ properties }}",
"copyable": {{ copyable }},
"etag": "{{ etag }}",
"sharingUser": "{{ sharingUser }}",
"alternateLink": "{{ alternateLink }}",
"embedLink": "{{ embedLink }}",
"webContentLink": "{{ webContentLink }}",
"fileSize": "{{ fileSize }}",
"copyRequiresWriterPermission": {{ copyRequiresWriterPermission }},
"permissions": "{{ permissions }}",
"hasThumbnail": {{ hasThumbnail }},
"spaces": "{{ spaces }}",
"folderColorRgb": "{{ folderColorRgb }}",
"id": "{{ id }}",
"title": "{{ title }}",
"description": "{{ description }}",
"labels": "{{ labels }}",
"explicitlyTrashed": {{ explicitlyTrashed }},
"createdDate": "{{ createdDate }}",
"modifiedDate": "{{ modifiedDate }}",
"modifiedByMeDate": "{{ modifiedByMeDate }}",
"lastViewedByMeDate": "{{ lastViewedByMeDate }}",
"markedViewedByMeDate": "{{ markedViewedByMeDate }}",
"sharedWithMeDate": "{{ sharedWithMeDate }}",
"quotaBytesUsed": "{{ quotaBytesUsed }}",
"version": "{{ version }}",
"indexableText": "{{ indexableText }}",
"originalFilename": "{{ originalFilename }}",
"ownedByMe": {{ ownedByMe }},
"canComment": {{ canComment }},
"shareable": {{ shareable }},
"fullFileExtension": "{{ fullFileExtension }}",
"isAppAuthorized": {{ isAppAuthorized }},
"teamDriveId": "{{ teamDriveId }}",
"capabilities": "{{ capabilities }}",
"hasAugmentedPermissions": {{ hasAugmentedPermissions }},
"trashingUser": "{{ trashingUser }}",
"canReadRevisions": {{ canReadRevisions }},
"thumbnailVersion": "{{ thumbnailVersion }}",
"trashedDate": "{{ trashedDate }}",
"permissionIds": "{{ permissionIds }}",
"thumbnail": "{{ thumbnail }}",
"imageMediaMetadata": "{{ imageMediaMetadata }}",
"videoMediaMetadata": "{{ videoMediaMetadata }}",
"shortcutDetails": "{{ shortcutDetails }}",
"contentRestrictions": "{{ contentRestrictions }}",
"resourceKey": "{{ resourceKey }}",
"linkShareMetadata": "{{ linkShareMetadata }}",
"labelInfo": "{{ labelInfo }}",
"sha1Checksum": "{{ sha1Checksum }}",
"sha256Checksum": "{{ sha256Checksum }}",
"inheritedPermissionsDisabled": {{ inheritedPermissionsDisabled }}
}'
;