Exporting spreadsheets as pdf with advanced options

4,870 views
Skip to first unread message

/mtv

unread,
Jan 6, 2011, 3:10:00 AM1/6/11
to google-docum...@googlegroups.com
Hello.

I am currently exporting spreadsheets created on the fly via the gdata java api. I am able to update the spreadsheets fine, and export them to pdf. 

After extensive searching I finally found the possibility to change the orientation with the extra parameter of: portrait=true

My question is; Is there other parameters I can issue to the export service?
I would really like to have the possibility to use all the parameters that are available in the UI when manually downloading pdf exports. In other words I would like to control; paper size, repeating headers, gridlines and size ("Fit to width"/"Actual size").

Thanx for your help!

/mtv

Vic Fryzel

unread,
Jan 11, 2011, 6:03:41 PM1/11/11
to google-docum...@googlegroups.com
Hi mtv,

Yes, there are :)

These are undocumented and are unsupported.  If these fail, you're out of luck.

Page size:
?size=legal/letter/A4

Which sheet to export (by number), e.g. 5.  Not positional.  If you delete Sheet1, the next sheet will be 2.
?gid=5

Page layout:
?portrait=true/false

Fit to page:
?fitw=true/false

Repeat header or frozen rows:
?fzr=true/false

Example:

Thanks,
-Vic

/mtv

unread,
Jan 12, 2011, 2:42:40 AM1/12/11
to Google Documents List API
Hi Vic.

Thank you very much! This will help me alot. Then there is only one
thing that I am still wondering about. The gridlines; are these also
possible to remove with a parameter in the query string?

I have another question also, which is a little on the side, but I am
still wondering about it.. Is it possible in spreadsheets to get page
numbers on the print out, like it is in the documents?

Thanx for your help!

/mtv

On Jan 12, 12:03 am, Vic Fryzel <vicfry...@google.com> wrote:
> Hi mtv,
>
> Yes, there are :)
>
> These are undocumented and are unsupported.  If these fail, you're out of
> luck.
>
> Page size:
> ?size=legal/letter/A4
>
> Which sheet to export (by number), e.g. 5.  Not positional.  If you delete
> Sheet1, the next sheet will be 2.
> ?gid=5
>
> Page layout:
> ?portrait=true/false
>
> Fit to page:
> ?fitw=true/false
>
> Repeat header or frozen rows:
> ?fzr=true/false
>
> Example:https://spreadsheets.google.com/feeds/downloads/spreadsheets/Export?k...
>
> Thanks,
> -Vic
>
>
>
>
>
>
>
> On Thu, Jan 6, 2011 at 12:10 AM, /mtv <m...@knowit.no> wrote:
> > Hello.
>
> > I am currently exporting spreadsheets created on the fly via the gdata java
> > api. I am able to update the spreadsheets fine, and export them to pdf.
>
> > After extensive searching I finally found the possibility to change the
> > orientation with the extra parameter of: portrait=true
> > So now my export url is: *
> >https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=${key}&exportFormat=pdf&portrait=true<https://spreadsheets.google.com/feeds/download/spreadsheets/Export?ke...>
> > *
> > *
> > *
> > My question is; *Is there other parameters I can issue to the export
> > service?*
> > I would really like to have the possibility to use all the parameters that
> > are available in the UI when manually downloading pdf exports. In other
> > words I would like to control; *paper size, repeating headers,* *gridlines
> > * and size ("Fit to width"/"Actual size").

Vic Fryzel

unread,
Jan 12, 2011, 2:54:58 AM1/12/11
to google-docum...@googlegroups.com
On Tue, Jan 11, 2011 at 11:42 PM, /mtv <m...@knowit.no> wrote:
Thank you very much! This will help me alot. Then there is only one
thing that I am still wondering about. The gridlines; are these also
possible to remove with a parameter in the query string?

We don't currently expose a parameter to remove gridlines.
 
I have another question also, which is a little on the side, but I am
still wondering about it.. Is it possible in spreadsheets to get page
numbers on the print out, like it is in the documents?

We also don't provide any way to add this for spreadsheets, but if you do an HTML export, you can get page numbers on output.

Thanks,
Vic

/mtv

unread,
Jan 12, 2011, 2:58:08 AM1/12/11
to Google Documents List API
Thank you for your quick response!! Your help has been very helpful!

Thank you!

/mtv

Karl Norby

unread,
Feb 14, 2011, 6:57:24 PM2/14/11
to Google Documents List API
On Jan 12, 1:54 am, Vic Fryzel <vicfry...@google.com> wrote:
> On Tue, Jan 11, 2011 at 11:42 PM, /mtv <m...@knowit.no> wrote:
>
> > Thank you very much! This will help me alot. Then there is only one
> > thing that I am still wondering about. The gridlines; are these also
> > possible to remove with a parameter in the query string?
>
> We don't currently expose a parameter to remove gridlines.

I did a bit of digging around to see what parameters the "Download As
PDF" function from the spreadsheet app was using, and I noticed that
all of the undocumented but exposed parameters mentioned on the export
api are the same on the internal one. I noticed that gridlines=true/
false was there, as well as r1/c1/r2/c2 for exporting a selection. Is
there any reason that all of this internal api can't be exposed, even
in an undocumented/unsupported way?
Thanks,
Karl

Pedro Paixao

unread,
Mar 26, 2011, 7:53:48 PM3/26/11
to google-docum...@googlegroups.com, Vic Fryzel
Thanks for the information on these options. The fitw=true/false is not working for me. Was anybody able to successfully use it?

my URL 

https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=YOUR_KEY"&gid=SHEET_ID&size=legal&fitw=true&portrait=false&exportFormat=pdf
Reply all
Reply to author
Forward
0 new messages