Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

recursive upload to Google Drive and import-export Google Apps Script source code

Project Description

a Python tool to Access to the Google Drive


import os
import googleDriveAccess

# create instance
da = googleDriveAccess.DAClient(os.path.abspath('.'))

# create parent folders at the same time
folderId, folderPath = da.makeDirs('/remote_drive/subfolder_test/subsubfolder')
print folderId, folderPath

# recursive backup to remote folder

How to use it

pip install 'google-api-python-client'
pip install googleDriveAccess
cd /opt/googleDriveAccess

# register your App on
# and *'download JSON'* of your Client ID and Client secret

# rename this JSON file to './client_secret_[Client ID].json'

# create './cicache.txt' file and write your Client ID to the first line.

# execute ./ to encrypt downloaded JSON file

# check that encrypted file exists './client_secret_[Client ID].json.enc'
# and plain text JSON file './client_secret_[Client ID].json' will be deleted

# execute ./ to test OAuth2 flow and store credentials

# execute ./ to test OAuth2 using stored credentials

# execute ./ to test Drive API search with query

# edit (set 'mode = 0')
# to test create new Google Apps Script
# 'test_GoogleAppsScript_createCalendarEvent' for tests below

# execute ./ to test create and *'get SCRIPT_ID'*

# edit (set 'mode = 2' and *'set SCRIPT_ID'*)
# to test download

# execute ./ to test download

# edit downloaded script
# './script_import_export/test_GoogleAppsScript_createCalendarEvent/'

# edit (set 'mode = 1') to test upload

# execute ./ to test upload

Known BUGs

When uploading a file that would not be automaticaly handled Google Drive, “Media type ‘None’ is not supported. Valid media types: [/]” error occurred. Because of default mimeType is set to None on uploadFile. So it may correct to catch the exception and retry with ‘binary/octet-stream’.

This program will cache each folder (or file) ids assigned by the Google Drive (into the cache file cache_folderIds.sl3) . Please search and erase a row that has same id from the cache file when you delete your folder or file using another Google Drive client tool.

(I will make


BSD License

Release History

Release History

This version
History Node


Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting