v0.5.xο
>>> import snapsheets as ss
>>> url = "https://docs.google.com/spreadsheets/d/1NbSH0rSCLkElG4UcNVuIhmg5EfjAk3t8TxiBERf6kBM/edit#gid=0"
>>> sheet = ss.Sheet(url=url, desc="Get Sample Sheet")
>>> sheet.snapshot()
π£ Get Sample Sheet
π€ Downloaded snapd/snapsheet.xlsx
π Renamed to snapd/20210412T104926_snapsheet.xlsx
CLIο
Added command line interface
$ snapsheets -h
usage: snapsheets [-h] [--config CONFIG] [--url URL] [-v]
optional arguments:
-h, --help show this help message and exit
--config CONFIG set config directory (default: ./config/)
--url URL copy and paste an URL of the Google spreadsheet
-v, --version show version
With --url optionο
Copy and paste the URL of Google spreadsheet
$ snapsheets --url https://docs.google.com/spreadsheets/d/1NbSH0rSCLkElG4UcNVuIhmg5EfjAk3t8TxiBERf6kBM/edit#gid=0
π£ snapsheet
π€ Downloaded snapd/snapsheet.xlsx
π Renamed to snapd/20210412T104926_snapsheet.xlsx
With no argumentο
Load from configuration file
$ snapsheets
ic| 'Loaded TOML files: ', n: 2
ic| 'Loaded TOML files: ', fname: PosixPath('config/gsheet.toml')
ic| 'Loaded TOML files: ', fname: PosixPath('config/snapsheets.toml')
ic| 'Add sheet', name: 'toml_sample1'
ic| 'Add sheet', name: 'toml_sample2'
π£ Example for Snapshot module (in TOML)
π€ Downloaded snapd/snapsheet.xlsx
π Renamed to snapd/2021_toml_sample1.xlsx
π£ 20210304_storage_comparison
π€ Downloaded snapd/snapsheet.xlsx
π Renamed to snapd/20210412_toml_sample2.xlsx
Show versionο
$ snapsheets -v
0.5.1
Configuration Filesο
Make
./config/directory and place your config files (TOML/YAML)If
confddoes not exist, it will search config files in. (current directory)You can change
confddirectory
Supported Formatο
#. TOML
#. YAML
Donβt mix two formats
TOMLoverridesYAMLsettings
Sectionsο
volumessaved: where to put download fileslogd: where to put logslogf: name of logfile
optionswget:--quiet
datefmtsheetsname: downloaded filename (without extensions)desc: description for you not to forgeturl: copy and paste an URL of the Google spreadsheetformat: select fromxlsx,ods,csv,tsvdatefmt: used as prefix of downloaded filenameskip: set true if you wanna skip downloading (default: false)
TOML Examplesο
config/sheet.tomlο
1[sheets]
2[sheets.toml_sample1]
3name = "toml_sample1"
4desc = "Example for Snapshot module (in TOML)"
5url = "https://docs.google.com/spreadsheets/d/1NbSH0rSCLkElG4UcNVuIhmg5EfjAk3t8TxiBERf6kBM/edit#gid=01NbSH0rSCLkElG4UcNVuIhmg5EfjAk3t8TxiBERf6kBM"
6format = "xlsx"
7datefmt = "%Y"
8
9[sheets.toml_sample2]
10name = "toml_sample2"
11desc = "20210304_storage_comparison"
12url = "https://docs.google.com/spreadsheets/d/16Sc_UgShNuxMfRnBiFsjmfThE1VfVhJf3jgmxNvFeEI/edit#gid=0"
13format = "csv"
14datefmt = "%Y%m%d"
YAML Examplesο
config/config.ymlο
1volumes:
2 snapd: 'snapd/'
3 logd: 'varlogs/'
4
5options:
6 wget:
7 '--quiet'
8
9datefmt: "%Y%m%dT%H%M%S"
config/sheet.ymlο
1sheets:
2 yaml_sample1:
3 name: "yaml_sample1"
4 desc: "Example for Snapshot module (in YAML)"
5 url: "https://docs.google.com/spreadsheets/d/1NbSH0rSCLkElG4UcNVuIhmg5EfjAk3t8TxiBERf6kBM/edit#gid=01NbSH0rSCLkElG4UcNVuIhmg5EfjAk3t8TxiBERf6kBM"
6 format: "xlsx"
7 datefmt: "%Y"