Google Drive Connector
Documentation
Version: 10
Documentation

EndPoint Download a file


Parameters

Parameter Label Required Options Description
Id File Id YES Id of a file you want to download
DriveType Drive Type YES
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.
DriveId Shared DriveId NO By default file lists from MyDrive but if you like to search other Shared drive (formally known as Team drive) then set this 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.

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Raw Description
Status 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:

Download a file using API Source

Google Drive
Download a file
SSIS API Source - Read from table or endpoint

Download a file using API Destination

Google Drive
Download a file
SSIS API Destination - Access table or endpoint

ODBC application

Use these SQL queries in your ODBC application data source:

Dowload a file (my drive)

Downloads a file (from user my drive)

SELECT * FROM download_file
  WITH(Id='1PpE2eSi5faAnMwiSolwr34zA5MwOdR3D'	
      ,ResponseDataFile='C:\MyFiles\myfile.ext'
  )
  --You can get file Id by selecting from 'list_files' endpoint

Dowload a file from google shared drive

Dowload a file from google shared drive for which user has access

SELECT * FROM download_file
WITH(
	  DriveType='drive' --or set 'user' for mydrive 
	, DriveId='0AFWIggplk2z6Uk9PVA'
	, Id='1hk7odj2Y2--yxN9DY0zW88hSnxqiyHq0' --file id
	, ResponseDataFile='c:\temp\dump.zip'
	--You can get file Id by selecting from 'list_files' endpoint
)

SQL Server

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

Dowload a file (my drive)

Downloads a file (from user my drive)

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM download_file
  WITH(Id=''1PpE2eSi5faAnMwiSolwr34zA5MwOdR3D''	
      ,ResponseDataFile=''C:\MyFiles\myfile.ext''
  )
  --You can get file Id by selecting from ''list_files'' endpoint';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_GOOGLE_DRIVE_IN_DATA_GATEWAY];

Dowload a file from google shared drive

Dowload a file from google shared drive for which user has access

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM download_file
WITH(
	  DriveType=''drive'' --or set ''user'' for mydrive 
	, DriveId=''0AFWIggplk2z6Uk9PVA''
	, Id=''1hk7odj2Y2--yxN9DY0zW88hSnxqiyHq0'' --file id
	, ResponseDataFile=''c:\temp\dump.zip''
	--You can get file Id by selecting from ''list_files'' endpoint
)';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_GOOGLE_DRIVE_IN_DATA_GATEWAY];