cristoper / gsheet

gsheet is a CLI tool (and Golang package) for piping csv data to and from Google Sheets
MIT License
83 stars 5 forks source link

Please add sheets array to info #8

Closed vimagick closed 4 months ago

vimagick commented 5 months ago

This tool is very helpful. I want to automate a task by a URL like this:

https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit#gid={sheetId}
                                        ^^^^^^^^^^^^^            ^^^^^^^

Then I'll export this sheet to csv:

$ gsheet sheetInfo spreadsheetId
{
  "sheets": [{...}, {...}, {...}]
}

# find title by sheetId
$ jq -r --argjson sheetId xxxxxxxxx '.sheets[].properties|select(.sheetId==$sheetId).title'

$ gsheet csv --id spreadsheetId --range 'sheetTitle'

Thanks!

Ref:

cristoper commented 5 months ago

Hi vimagick,

Are you able to try the sheetinfo branch (PR #9) and see if it works for your purposes? In particular the new gsheet title --id $SHEET_ID --sheetid $GID command in that PR should make it easy to look up a sheet title from a sheet id in your script.

vimagick commented 4 months ago

Great! 👏

cristoper commented 4 months ago

I merged the new commands to master and released v0.1.3:

https://github.com/cristoper/gsheet/releases/tag/v0.1.3