SQL query examples
The ZappySys API Driver is a user-friendly interface designed to facilitate the seamless integration of various applications with the Google Drive API. With its intuitive design and robust functionality, the ZappySys API Driver simplifies the process of configuring specific API endpoints to efficiently read or write data from Google Drive.
On this page you will find some SQL examples which can be used for API ODBC Driver or Data Gateway API Connector.
Get my drive information
Gets my drive information [ Read more... ]
SELECT * FROM Drive
List all shared drives
List all shared drives [ Read more... ]
SELECT * FROM SharedDrives --WITH(Query='name = "HR"')
Get information about shared drive
Get information about shared drive [ Read more... ]
SELECT * FROM SharedDrives WITH(Query='name = "HR"')
List / search files from my drive
List or search files from my drive (use search query expression). Uncomment Query part to invoke filter [ Read more... ]
SELECT * FROM Files
WITH(
--Query='name contains "ZappySys*.*"', --includes files where name contains "zappysys" word
)
List / search files from a single shared drive
List or search files from a specific shared drive by driveId and search query expression. Uncomment Query part to invoke filter [ Read more... ]
SELECT * FROM Files
WITH(
--Query='name contains "ZappySys*.*"', --includes files where name contains "zappysys" word
DriveId='0AFWIggplk2z6Uk9PVA',
DriveType='drive',
SupportsAllDrives='true',
IncludeItemsFromAllDrives='true'
)
List / search files from all shared drives
List or search files from all shared drives by driveId and search query expression. Uncomment Query part to invoke filter [ Read more... ]
SELECT * FROM Files
WITH(
--Query='name contains "ZappySys*.*"', --includes files where name contains "zappysys" word
DriveType='allDrives',
SupportsAllDrives='true',
IncludeItemsFromAllDrives='true'
)
List / search items (files/folders) from a parent folder in recursive or non-recursive mode
This example shows how to list files from a parent folder, optionally you can specifiy item types to list (e.g. files, folders, sheets, documents). If you do not specify FolderId then recursive list is returned. [ Read more... ]
SELECT * FROM list_parent_items
WITH(
--Parent folder id (Keep it blank to scan all files in all folders - recursive
FolderId='1VK5NBhuOTaLEy1pBMsQtG672vrJNgxai'
--List only from Trash (deleted files)
, IncludeFromTrash='false'
--Extra search criteria
--, Query='or (name contains ''blog'') or (name contains ''test'') ' --extra query
--Item type to return (default is all)
--, ItemType='files' -- (default=all) all, files, folders, sheets, documents, files_native, files_exclude_native
--, ItemType='folders'
--, ItemType='sheets'
--, ItemType='files_native'
)
Dowload a file (my drive)
Downloads a file (from user my drive) [ Read more... ]
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 [ Read more... ]
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
)
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. [ Read more... ]
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'
)
Get file list
Downloads a file [ Read more... ]
SELECT * FROM Files
Update a file
Updates a file [ Read more... ]
UPDATE Files
WITH (Id='1EVzXFVBQIh3LcJvfcLhI1UWhW3qUxFkM'
,DiskFilePath='C:\MyFiles\myfile.ext')
--You can get file Id by selecting from 'list_files' endpoint
Delete a file
Deletes a file [ Read more... ]
DELETE FROM Files
WITH (Id='1gcu0hV34OTfgvcu9CFhr7Go4b35j5Mop')
--You can get file Id by selecting from 'list_files' endpoint
Delete a file by name from a shared drive
Delete a file by name from a shared drive [ Read more... ]
DELETE FROM Files where Name='dump.csv' and Trashed=0 WITH(DriveId='0AC00HWQH144cUk9PVA', DriveType='drive')
--You can get file Id by selecting from 'list_files' endpoint
Upload a file with INSERT keyword
Upload a file with INSERT keyword. Advantage of INSERT is you can use Bulk option using SOURCE clause. This way you can upload many files [ Read more... ]
INSERT INTO Files
WITH (FileName='My filename'
,DiskFilePath='C:\MyFolder\Mymyfile.ext'
,ParentFolderId='root'
)
--You can get ParentFolderId by selecting from 'list_folders' endpoint or just use 'root'
Delete a folder
Deletes a folder [ Read more... ]
DELETE FROM Folders
WITH (Id='1yDO11prsLH9DUrBTCadV6GGMJrITjF9I')
--You can get folder Id by selecting from 'list_folders' endpoint
Create a folder
Creates a folder [ Read more... ]
INSERT INTO Folders
WITH (Name='My folder name'
,ParentFolderId='root')
--You can get ParentFolderId by selecting from 'list_folders' endpoint or just use 'root'
Get file information
Gets file information [ Read more... ]
SELECT * FROM FileInfo
WITH (Id='1EVzXFVBQIh3LcJvfcLhI1UWhW3qUxFkM')
--You can get file Id by selecting from 'list_files' endpoint
Get items list
Gets items list [ Read more... ]
SELECT * FROM ItemsList
Get items list using query
Gets items list using query [ Read more... ]
SELECT Id, Kind, Name, MimeType
FROM list_items
WITH (Query = 'name contains ''.txt''')
Get files list
Gets files list [ Read more... ]
SELECT * FROM FilesList
Get folders list
Gets folders list [ Read more... ]
SELECT * FROM FoldersList
Select from trash
Shows deleted items in Trash [ Read more... ]
SELECT * FROM Trash
List files from trash for a shared drive
Shows deleted items in Trash [ Read more... ]
SELECT * FROM Trash
WITH(
DriveType='drive'
,DriveId='1j0HFOP4gsoExxxxxx' --get id from select * from SharedDrives
)
Empty trash bin
Empties trash bin [ Read more... ]
DELETE FROM Trash
Empty trash bin for a shared drive
Empties trash bin for a specified shared drive [ Read more... ]
DELETE FROM Trash
WITH(
DriveType='drive'
,DriveId='1j0HFOP4gsoExxxxxx' --get id from select * from SharedDrives
)
Export Google Sheet to Excel (xlsx) or PDF
Export a Google files to other format (e.g. Google Sheets to MS Excel / PDF) [ Read more... ]
SELECT "Status" FROM export_file
WITH(
Id='1j0HFOP4gsoE-Zbf2xN3IsPSj8wgwNtIfyyvM1_BWkW4' --//google sheet id or document ID
--,DriveId='xx your shared drive id' --get id from select * from SharedDrives
--,DriveType='drive'
, ExportAs='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
--, ExportAs='application/pdf'
, ResponseDataFile='c:\temp\sheet1.xlsx'
, FileOverwriteMode='AlwaysOverwrite' -- or try 'FailIfExists' or 'SkipIfExists'
))
--You can export files from 'export_file' endpoint
Getting Started with Examples
ZappySys API Driver is a powerful software solution designed to facilitate the extraction and integration of data from a wide range of sources through APIs. Its intuitive design and extensive feature set make it an essential asset for any organization dealing with complex data integration tasks.
To get started with examples using ZappySys API Driver, please click on the following applications:
Key features of the ZappySys API Driver include:
The API ODBC driver facilitates the reading and writing of data from numerous popular online services (refer to the complete list here) using familiar SQL language without learning complexity of REST API calls. The driver allows querying nested structure and output as a flat table. You can also create your own ODBC / Data Gateway API connector file and use it with this driver.
Intuitive Configuration: The interface is designed to be user-friendly, enabling users to easily set up the specific API endpoints within Google Drive without requiring extensive technical expertise or programming knowledge.
Customizable Endpoint Setup: Users can conveniently configure the API endpoint settings, including the HTTP request method, endpoint URL, and any necessary parameters, to precisely target the desired data within Google Drive.
Data Manipulation Capabilities: The ZappySys API Driver allows for seamless data retrieval and writing, enabling users to fetch data from Google Drive and perform various data manipulation operations as needed, all through an intuitive and straightforward interface.
Secure Authentication Integration: The driver provides secure authentication integration, allowing users to securely connect to the Google Drive API by inputting the necessary authentication credentials, such as API tokens or other authentication keys.
Error Handling Support: The interface is equipped with comprehensive error handling support, ensuring that any errors or exceptions encountered during the data retrieval or writing process are efficiently managed and appropriately communicated to users for prompt resolution.
Data Visualization and Reporting: The ZappySys API Driver facilitates the seamless processing and presentation of the retrieved data from Google Drive, enabling users to generate comprehensive reports and visualizations for further analysis and decision-making purposes.
Overall, the ZappySys API Driver serves as a powerful tool for streamlining the integration of applications with Google Drive, providing users with a convenient and efficient way to access and manage data, all through a user-friendly and intuitive interface.