bassarisse / google-spreadsheet-to-json

Simple tool to export Google Spreadsheets to JSON files, though Node API or CLI
The Unlicense
134 stars 33 forks source link

How to get spreadsheet that contains sheet id (gid)? #11

Open soutot opened 7 years ago

soutot commented 7 years ago

Hi,

I have 2 spreadsheets that looks like this: https://docs.google.com/spreadsheets/d/1234abcd/pub?gid=0&single=true&output=xlsx https://docs.google.com/spreadsheets/d/1234abcd/pub?gid=09876&single=true&output=xlsx

How do I specify which spreadsheet from id 1234abcd I want to work with? I couldn't find any property like "worksheet_id", neither I was able to use the gid querystring in "spreadsheedId" property.

Thanks in advance

bassarisse commented 7 years ago

Hey there,

You can use the worksheet option, passing the name or the index of the desired worksheet (-w or --worksheet in command-line).

damianobarbati commented 6 years ago

+1 for this feature: @bassarisse actually the "gid" is not working

const assets = await gsjson({
    spreadsheetId: '1WXQ4mmU0lKSIivxejPdrS7SHgxQCIxnJ8evVLWszuKs',
    worksheet: ['380908001'],
});      
Failure: Error: No worksheet found!

You did a great job with this repo!

bassarisse commented 6 years ago

Sorry if I didn't make myself clear. Matching the worksheet by the "gid" is currently not supported, ony by name or index.