cristoper/gsheet

Please add sheets array to info

vimagick opened this issue ยท 3 comments

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:

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.

Great! ๐Ÿ‘

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

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