Google Drive Connector
Documentation
Version: 10
Documentation

EndPoint Upload a file (with overwrite action)


Name

upload_file_overwrite

Description

Uploads a file (if file with same name exists then overwrite else create a new file). [API reference]

Parameters

Parameter Label Required Options Description
FileName Target FileName YES A filename the file will have in Google Drive
DiskFilePath Local FilePath YES Specify a disk file path
FileOverwriteMode File Overwrite Mode YES
KeepRevisionForever Keep Revision Forever NO
Option Value
true true
false false
Defines whether uploaded file has revisions
ParentFolderId Parent FolderId NO Id of a parent folder you want to upload the file in. Use value 'root' to place the file in the topmost level.
DriveId Shared DriveId NO By default file lists from MyDrive but if you like to search other Shared drive then set this parameter.
DriveType Drive Type NO
Option Value
My Drive user
Shared Drive drive
Default search context is User's drive. Bodies of items (files/documents) to which the query applies. Supported bodies are 'user', 'domain', 'drive', and 'allDrives'. Prefer 'user' or 'drive' to 'allDrives' for efficiency. By default, corpora is set to 'user'. However, this can change depending on the filter set through the 'Query' parameter.
SupportsAllDrives Supports all drives (e.g. My and Shared) NO
Option Value
true true
false false
Whether the requesting application supports both My Drives and shared drives.
AddParents AddParents NO A comma-separated list of parent IDs to add
ocrLanguage OcrLanguage NO A language hint for OCR processing during image import (ISO 639-1 code).
useContentAsIndexableText UseContentAsIndexableText NO Whether to use the uploaded content as indexable text.

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Raw Description
Id DT_WSTR nvarchar(440) 440 False
Kind DT_WSTR nvarchar(200) 200 False
Name DT_WSTR nvarchar(780) 780 False
MimeType DT_WSTR nvarchar(650) 650 False
FileSize DT_I8 bigint False
DriveId DT_WSTR nvarchar(4000) 4000 False

Input Columns

Label Data Type (SSIS) Data Type (SQL) Length Raw Description
There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime.

Examples

SSIS

Use Google Drive Connector in API Source component to read data or in API Destination component to read/write data:

Upload a file (with overwrite action) using API Source

Google Drive
Upload a file (with overwrite action)
SSIS API Source - Read from table or endpoint

Upload a file (with overwrite action) using API Destination

Google Drive
Upload a file (with overwrite action)
SSIS API Destination - Access table or endpoint

ODBC application

Use these SQL queries in your ODBC application data source:

Upload local file to google shared drive folder (Overwrite if exists)

Upload a local file to google shared drive folder for which user has access. Donot set DriveId to upload to MyDrive rather than sahred drive.

SELECT *
FROM upload_file_overwrite
WITH(
	  DriveId='' --for my drive keep blank
	--DriveId='0AC00HWQH144cUk9PVA' --team drive id (keep blank for uploading to my drive)
	
	, DiskFilePath='C:\temp\dump.csv' --source file path
	, FileName='dump.csv' --target file name
	, ParentFolderId='root'
	--OR--
	--, ParentFolderId='1PRySfNNjWIp9ZAnhPh-u9tKRj3QOETSq'

	--, FileOverwriteMode='AlwaysOverwrite'
	--OR--
	--, FileOverwriteMode='FailIfExists' 
	
	--, KeepRevisionForever='false'	
)

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Upload local file to google shared drive folder (Overwrite if exists)

Upload a local file to google shared drive folder for which user has access. Donot set DriveId to upload to MyDrive rather than sahred drive.

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT *
FROM upload_file_overwrite
WITH(
	  DriveId='''' --for my drive keep blank
	--DriveId=''0AC00HWQH144cUk9PVA'' --team drive id (keep blank for uploading to my drive)
	
	, DiskFilePath=''C:\temp\dump.csv'' --source file path
	, FileName=''dump.csv'' --target file name
	, ParentFolderId=''root''
	--OR--
	--, ParentFolderId=''1PRySfNNjWIp9ZAnhPh-u9tKRj3QOETSq''

	--, FileOverwriteMode=''AlwaysOverwrite''
	--OR--
	--, FileOverwriteMode=''FailIfExists'' 
	
	--, KeepRevisionForever=''false''	
)';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_GOOGLE_DRIVE_IN_DATA_GATEWAY];