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 | Required | Options | ||||||
|---|---|---|---|---|---|---|---|---|
|
Name:
Label: Target FileName A filename the file will have in Google Drive |
YES | |||||||
|
Name:
Label: Local FilePath Specify a disk file path |
YES | |||||||
|
Name:
Label: File Overwrite Mode |
YES | |||||||
|
Name:
Label: Keep Revision Forever Defines whether uploaded file has revisions |
|
|||||||
|
Name:
Label: Parent FolderId Id of a parent folder you want to upload the file in. Use value 'root' to place the file in the topmost level. |
||||||||
|
Name:
Label: Shared DriveId By default file lists from MyDrive but if you like to search other Shared drive then set this parameter. |
||||||||
|
Name:
Label: Drive Type 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. |
|
|||||||
|
Name:
Label: Supports all drives (e.g. My and Shared) Whether the requesting application supports both My Drives and shared drives. |
|
|||||||
|
Name:
Label: AddParents A comma-separated list of parent IDs to add |
||||||||
|
Name:
Label: OcrLanguage A language hint for OCR processing during image import (ISO 639-1 code). |
||||||||
|
Name:
Label: UseContentAsIndexableText Whether to use the uploaded content as indexable text. |
Output Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| Id |
DT_WSTR
|
nvarchar(440)
|
440 | |
| Kind |
DT_WSTR
|
nvarchar(200)
|
200 | |
| Name |
DT_WSTR
|
nvarchar(780)
|
780 | |
| MimeType |
DT_WSTR
|
nvarchar(650)
|
650 | |
| FileSize |
DT_I8
|
bigint
|
||
| DriveId |
DT_WSTR
|
nvarchar(4000)
|
4000 |
Input Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | 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 or in API Destination SSIS Data Flow components to read or write data.
API Source
| Required Parameters | |
|---|---|
| Target FileName | Fill-in the parameter... |
| Local FilePath | Fill-in the parameter... |
| File Overwrite Mode | Fill-in the parameter... |
| Optional Parameters | |
| EnableCustomReplace | True |
| SearchFor | [] |
| ReplaceWith | [{id:null}] |
| Keep Revision Forever | |
| Parent FolderId | root |
| Shared DriveId | |
| Drive Type | user |
| Supports all drives (e.g. My and Shared) | true |
| RawOutputDataRowTemplate | {Status:'Uploaded'} |
| EnableRawOutputModeSingleRow | True |
| AddParents | |
| OcrLanguage | |
| UseContentAsIndexableText | False |
API Destination
| Required Parameters | |
|---|---|
| Target FileName | Fill-in the parameter... |
| Local FilePath | Fill-in the parameter... |
| File Overwrite Mode | Fill-in the parameter... |
| Optional Parameters | |
| EnableCustomReplace | True |
| SearchFor | [] |
| ReplaceWith | [{id:null}] |
| Keep Revision Forever | |
| Parent FolderId | root |
| Shared DriveId | |
| Drive Type | user |
| Supports all drives (e.g. My and Shared) | true |
| RawOutputDataRowTemplate | {Status:'Uploaded'} |
| EnableRawOutputModeSingleRow | True |
| AddParents | |
| OcrLanguage | |
| UseContentAsIndexableText | False |
ODBC application
Use these SQL queries in your ODBC application data source:
Upload file to shared drive folder (overwrite if exists)
<p>Uploads a local file to a folder in a shared drive (or to My Drive if <code>DriveId</code> is left blank). Supply the source file path (<code>DiskFilePath</code>), target file name, and parent folder ID. You can choose to overwrite existing files or fail if the file exists.</p>
SELECT *
FROM upload_file_overwrite
WITH(
DriveId='',
DiskFilePath='C:\temp\dump.csv',
FileName='dump.csv',
ParentFolderId='root'
--, FileOverwriteMode='AlwaysOverwrite'
--, FileOverwriteMode='FailIfExists'
)
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
Upload file to shared drive folder (overwrite if exists)
<p>Uploads a local file to a folder in a shared drive (or to My Drive if <code>DriveId</code> is left blank). Supply the source file path (<code>DiskFilePath</code>), target file name, and parent folder ID. You can choose to overwrite existing files or fail if the file exists.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT *
FROM upload_file_overwrite
WITH(
DriveId='''',
DiskFilePath=''C:\temp\dump.csv'',
FileName=''dump.csv'',
ParentFolderId=''root''
--, FileOverwriteMode=''AlwaysOverwrite''
--, FileOverwriteMode=''FailIfExists''
)';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];