Links to data inside sheet in GoogleSpreadsheets

363 views
Skip to first unread message

Olemis Lang

unread,
Jun 9, 2009, 10:51:47 AM6/9/09
to google-visua...@googlegroups.com
Hello !

I have a spreadsheet containing two sheets (Sheet 1 & Sheet 2). I
tried to get the JSON for data in Sheet 2 through a url [1]_ but it
returns back data in Sheet1 . This shouldnt be wrong, but I'd like to
know what's the URL used to access the data in a different sheet
inside the same spreadsheet (same ID)

.. [1] Target URL
(http://spreadsheets.google.com/tq?key=r_Fp1ZkDtzsDzRJ23jmnc9w)

Thnx in advance !

--
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
¡ Bienvenido OpenSolaris 2009.06 ! -
http://feedproxy.google.com/~r/simelo-es/~3/UY8IF3M3Alw/bienvenido-opensolaris-200906.html

Olemis Lang

unread,
Jun 9, 2009, 10:58:26 AM6/9/09
to google-visua...@googlegroups.com

VizGuy

unread,
Jun 10, 2009, 7:44:32 AM6/10/09
to google-visua...@googlegroups.com
Hi,

This is not documented from some reason, so we will add it very soon.

Anyway - it is possible, and the usage is as follows

For a workbook with two sheets: Sheet 1, Sheet 2.
You can access a specific sheet as follows

Sheet1
https://spreadsheets.google.com/tq?key=ABCD&sheet=Sheet%201 
OR
https://spreadsheets.google.com/tq?key=ABCD&gid=0

Sheet2
https://spreadsheets.google.com/tq?key=ABCD&sheet=Sheet%202 
OR
https://spreadsheets.google.com/tq?key=ABCD&gid=1

Notes:
1) Spaces in sheet names should be encoded as %20
2) gid - grid id which zero based. Each added sheet gets the next running id regardless if grids are deleted.
3) See the docs about the grid parameter that lets you specify a range of cells (A1:C5).


Regards,
VizGuy

Olemis Lang

unread,
Jun 10, 2009, 9:03:53 AM6/10/09
to google-visua...@googlegroups.com
> On Tue, Jun 9, 2009 at 5:51 PM, Olemis Lang <ole...@gmail.com> wrote:
>>
>> Hello !
>>
>> I have a spreadsheet containing two sheets (Sheet 1 & Sheet 2). I
>> tried to get the JSON for data in Sheet 2 through a url [1]_ but it
>> returns back data in Sheet1 . This shouldnt be wrong, but I'd like to
>> know what's the URL used to access the data in a different sheet
>> inside the same spreadsheet (same ID)
>>

On Wed, Jun 10, 2009 at 6:44 AM, VizGuy<viz...@google.com> wrote:
> Hi,

Hi !

> This is not documented from some reason,

:-/

> so we will add it very soon.

:) ... it would be nice to include something like that in the page
about GViz API integration with Google Spreadsheets

> Anyway - it is possible, and the usage is as follows
> For a workbook with two sheets: Sheet 1, Sheet 2.
> You can access a specific sheet as follows
>
> Sheet1
> https://spreadsheets.google.com/tq?key=ABCD&sheet=Sheet%201
> OR
> https://spreadsheets.google.com/tq?key=ABCD&gid=0
>
> Sheet2
> https://spreadsheets.google.com/tq?key=ABCD&sheet=Sheet%202
> OR
> https://spreadsheets.google.com/tq?key=ABCD&gid=1
>

Cool !

> Notes:
> 1) Spaces in sheet names should be encoded as %20
> 2) gid - grid id which zero based. Each added sheet gets the next running id
> regardless if grids are deleted.

Q: So this means that if I create `sheet 1`, and later `sheet 2` and
e.g. I (move sheet 2 to the left | delete sheet 1) then sheet 2 still
has gid = 1 . Isnt it ?

> 3) See the docs about the grid parameter that lets you specify a range of
> cells (A1:C5).
>

Oh yes !

This is well documented in the page about GViz API integration with
Google Spreadsheets (AFAICR I even added support for this in TracLinks
expansion [1]_ for iGoogleGadget macro [2]_ included in TracGViz
plugin [3]_ since version 1.3.1 ) I plan to include this «new» feature
in the next version ;)

I asked because there's nothing about this in docs, I just tried for
the first time to add multiple sheets inside a spreadsheet, and later
I didnt know how to get the data . And I knew that there should be a
way ;)

Thnx for your reply !

.. [1] tracgviz.wiki.GoogleDocsConnector
(https://opensvn.csie.org/traccgi/swlcu/pydoc/tracgviz.wiki.GoogleDocsConnector)

.. [2] iGoogleGadget macro
(https://opensvn.csie.org/traccgi/swlcu/wiki/En/Devel/TracGViz/Macro/iGoogleGadget)

.. [3] TracGViz plugin
(https://opensvn.csie.org/traccgi/swlcu/wiki/En/Devel/TracGViz)

.. [4] TracLinks reference (I'm still editing this page ;)
(https://opensvn.csie.org/traccgi/swlcu/wiki/En/Devel/TracGViz/TracLinks#Reference)

--
Regards,

Olemis.

Featured article:
PyUMLGraph : Otra manera de contemplar el código -
http://feedproxy.google.com/~r/simelo-es/~3/lLsxDz4Rkgc/pyumlgraph-mirando-al-codigo-de-python.html

Olemis Lang

unread,
Jun 16, 2009, 2:33:32 PM6/16/09
to google-visua...@googlegroups.com
On Wed, Jun 10, 2009 at 6:44 AM, VizGuy<viz...@google.com> wrote:
> Hi,
>
> You can access a specific sheet as follows
>
> Sheet1
> https://spreadsheets.google.com/tq?key=ABCD&sheet=Sheet%201
>
> Notes:
> 1) Spaces in sheet names should be encoded as %20


JFYI ... The + sign can be used too . I just tried [1]_ and it works
(returns the following data as expected ;)

{{{
#!json

google.visualization.Query.setResponse({version:'0.6',status:'ok',sig:'1202388977',table:{cols:[{id:'A',label:'Browser
and OS',type:'string',pattern:''},{id:'B',label:'junio\n',type:'number',pattern:'#0.###############'}],rows:[{c:[{v:'Chrome
/ Windows'},{v:0.07488986784141,f:'0.07488986784141'}]},{c:[{v:'Firefox
/ Linux'},{v:0.2511013215859,f:'0.2511013215859'}]},{c:[{v:'Firefox /
Windows'},{v:0.19823788546256,f:'0.19823788546256'}]},{c:[{v:'Mozilla
/ Linux'},{v:0.044052863436123,f:'0.044052863436123'}]},{c:[{v:'Opera
/ Linux'},{v:0.2511013215859,f:'0.2511013215859'}]},{c:[{v:'Opera /
Windows'},{v:0.035242290748899,f:'0.035242290748899'}]},{c:[{v:'Internet
Explorer / Windows'},{v:0.11894273127753,f:'0.11894273127753'}]},{c:[{v:'Safari
/ Macintosh'},{v:0.026431718061674,f:'0.026431718061674'}]}]}});

}}}

Thnx very much :)

.. [1] http://spreadsheets3.google.com/tq?key=r_Fp1ZkDtzsDzRJ23jmnc9w&sheet=Sheet+1

--
Regards,

Olemis.

Featured article:
Rolland Garros : nuevas formas de contemplar los juegos -
http://simelo-es.blogspot.com/2009/06/rolland-garros-nuevas-formas-de.html

Reply all
Reply to author
Forward
0 new messages