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] [--docid DOCID] [--title DOCTITLE] [--verbose]

[--min-rows MIN_ROWS]
[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:apples.csv Oranges:oranges.csv

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:

* google-api-python-client (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:

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

options:

show this help message and exit
Spreadsheets doc id to update
Set or update the spreadsheet's title
Print out the log
Minimum number rows to resize uploaded sheet to. This is useful when another sheet feeds from the uploaded one, which otherwise automatically renumbers its references to rows beyond it if they existed, to avoid most such resizing woes.
December 2023 upload-to-sheets 2.3.6