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 confd does not exist, it will search config files in . (current directory)

  • You can change confd directory

Supported Format

#. TOML #. YAML

  • Don’t mix two formats

  • TOML overrides YAML settings

Sections

  • volumes

    • saved : where to put download files

    • logd : where to put logs

    • logf : name of logfile

  • options

    • wget : --quiet

  • datefmt

  • sheets

    • name : downloaded filename (without extensions)

    • desc : description for you not to forget

    • url : copy and paste an URL of the Google spreadsheet

    • format : select from xlsx, ods, csv, tsv

    • datefmt : used as prefix of downloaded filename

    • skip : 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"