https://github.com/tomgp/gs-download
command line tool to download a google sheet as a bunch of CSVs
https://github.com/tomgp/gs-download
Last synced: 27 days ago
JSON representation
command line tool to download a google sheet as a bunch of CSVs
- Host: GitHub
- URL: https://github.com/tomgp/gs-download
- Owner: tomgp
- Created: 2022-07-07T08:47:44.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-16T13:05:36.000Z (almost 4 years ago)
- Last Synced: 2025-02-15T09:46:04.509Z (over 1 year ago)
- Language: JavaScript
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gsdownload
Download Google sheets as CSVs using a service account.
## Process overview
1. Create a Google service account
2. Share your spreadsheet with that account
3. Provide credentials from that account to `gsdownload` along with a sheet ID and it will download each worksheet as a CSV file to a location you specify
>Be careful not to leak your private key. Provide it as an environment variable/ secret and don't commit it to your repository
This mainly developed for use in a CI context so...
## CI usage
To use _gsdownload_ in a CI context (like Github actions for example) you need to
1. set `GOOGLE_CLIENT_EMAIL` and `GOOGLE_PRIVATE_KEY` as environment variables / secrets for github actions you can do this in the repo Settings->Secrets->Actions i.e. `https://github.com///settings/secrets/actions`
2. make sure your task runner can install & run node scripts and in your CI workflow globally install _gsdownload_ `npm i -g @tomgp/gsdownload`
3. in your CI workflow add the command `getsheet ` and the worksheet CSVs should hopefully appear in `output_directory`
## otherwise, to use it in anothe Node script...
```js
const { getSheet } = require('./index.js');
getSheet( , , , );
```