Endpoint Download a file
Name
download_file
Description
Downloads a file [API reference]
Parameters
| Parameter | Required | Options | ||||||
|---|---|---|---|---|---|---|---|---|
|
Name:
Label: File Id Id of a file you want to download |
YES | |||||||
|
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. |
YES |
|
||||||
|
Name:
Label: Shared DriveId By default file lists from MyDrive but if you like to search other Shared drive (formally known as Team drive) then set this parameter. |
||||||||
|
Name:
Label: Supports all drives (e.g. My and Shared) Whether the requesting application supports both My Drives and shared drives. |
|
Output Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| Status |
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 | |
|---|---|
| File Id | Fill-in the parameter... |
| Overwrite Mode | Fill-in the parameter... |
| Local File Path | Fill-in the parameter... |
| Optional Parameters | |
| RequestTimeoutMs | 7200000 |
| SaveContentAsBinary | True |
| RawOutputDataRowTemplate | {Status:'Downloaded'} |
| EnableRawOutputModeSingleRow | True |
API Destination
| Required Parameters | |
|---|---|
| File Id | Fill-in the parameter... |
| Overwrite Mode | Fill-in the parameter... |
| Local File Path | Fill-in the parameter... |
| Optional Parameters | |
| RequestTimeoutMs | 7200000 |
| SaveContentAsBinary | True |
| RawOutputDataRowTemplate | {Status:'Downloaded'} |
| EnableRawOutputModeSingleRow | True |
ODBC application
Use these SQL queries in your ODBC application data source:
Download a file (my drive)
<p>Downloads a file from the user's My Drive to a local path. Supply the file ID and the destination path (<code>ResponseDataFile</code>).</p>
SELECT * FROM download_file
WITH(Id='1PpE2eSi5faAnMwiSolwr34zA5MwOdR3D',
ResponseDataFile='C:\MyFiles\myfile.ext')
Download a file from a shared drive
<p>Downloads a file from a shared drive to a local path. Supply <code>DriveId</code>, <code>DriveType='drive'</code>, the file ID, and the destination path.</p>
SELECT * FROM download_file
WITH(
DriveType='drive',
DriveId='0AFWIggplk2z6Uk9PVA',
Id='1hk7odj2Y2--yxN9DY0zW88hSnxqiyHq0',
ResponseDataFile='c:\temp\dump.zip'
)
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
Download a file (my drive)
<p>Downloads a file from the user's My Drive to a local path. Supply the file ID and the destination path (<code>ResponseDataFile</code>).</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM download_file
WITH(Id=''1PpE2eSi5faAnMwiSolwr34zA5MwOdR3D'',
ResponseDataFile=''C:\MyFiles\myfile.ext'')';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];
Download a file from a shared drive
<p>Downloads a file from a shared drive to a local path. Supply <code>DriveId</code>, <code>DriveType='drive'</code>, the file ID, and the destination path.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM download_file
WITH(
DriveType=''drive'',
DriveId=''0AFWIggplk2z6Uk9PVA'',
Id=''1hk7odj2Y2--yxN9DY0zW88hSnxqiyHq0'',
ResponseDataFile=''c:\temp\dump.zip''
)';
EXEC (@MyQuery) AT [LS_TO_GOOGLE_DRIVE_IN_GATEWAY];