Scroll to navigation

UPLOAD-TO-SHEETS(1) User Commands UPLOAD-TO-SHEETS(1)

NAME

upload-to-sheets - publish CSV files to Google Spreadsheet

DESCRIPTION

usage: upload-to-sheets [-h] [--auth_host_name AUTH_HOST_NAME]
[--noauth_local_webserver]
[--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]] [--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--docid DOCID] [--title DOCTITLE] [--verbose] [filenames [filenames ...]]

Publish a CSV file to a Google Spreadsheet sheet.

This is a convenient script to update an existing Google Spreadsheet document with the contents of a CSV file.

NOTE: This script replaces and obsoletes 'upload-csv-to-google-sheet'.

For example, this invocation creates a new Google Sheet doc and upload the contents of the CSV files to sheets named 'apples' and 'oranges':

upload-to-sheets apples.csv oranges.csv

You can override the name of the sheets created by appending a colon and the name, like this:

upload-to-sheets apples.csv:Apples oranges.csv:Oranges

If you'd like to upload the sheets in an existing document, provide it as an option:

upload-to-sheets --docid="1xcCjHM...j1ubo0Y09DfGn8HRMLY" apples.csv oranges.csv

Note that if you do this and there are existing sheets with the same names, e.g. "apples", the contents of these sheets will be replaced by the uploaded contents. All the other sheets will remain untouched. This is designed so that you can manually craft a custom spreadsheet and upload only some of it sheets with contents derived from another program (e.g. Beancount).

This script only requires the latest and official Google client API libraries (it does not need gdata nor Python wrappers for sheets). It uses the v4 Sheets API (current as of 2013-2017-12-15). You will need to have an installation of the following libraries for this to work:

* apiclient (Google Python client API) * oauth2client * httplib2

Moreover, you will need to enable the Google Sheets API in the developer console and download the Client Secrets that Google provides to ~/.google-apis.json. (You can override this location with the GOOGLE_APIS environment variable.)

positional arguments:

filenames
CSV filenames[:name] to upload. If 'name' is not provided, infer from the filename.

optional arguments:

-h, --help
show this help message and exit
--auth_host_name AUTH_HOST_NAME
Hostname when running a local web server.
--noauth_local_webserver
Do not run a local web server.
--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]
Port web server should listen on.
--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
Set the logging level of detail.
--docid DOCID, --doc DOCID, --id DOCID, -d DOCID
Spreadsheets doc id to update
--title DOCTITLE, -t DOCTITLE
Set or update the spreadsheet's title
--verbose, -v
Print out the log
April 2019 upload-to-sheets 2.2.0