Export PDF from a Google Sheet (WITH OPTIONS!)
New FREE TOOL to generate a URL to export your Google Sheet to PDF
Export Google Sheet to PDF Explained
Let's export a PDF from a Google Sheet
format=pdf
At the end of a Google Sheet url you'll add /export and then a question mark:
/export?format=pdf
While your original URL will have "/edit#gid="_____ some GID, you should
https://docs.google.com/spreadsheets/d/1NiBkb0xwMvljLPG1e9wOStx71PFu9CwYdz7aDzuzDtA/edit#gid=0
A pdf export URL will look like this:
https://docs.google.com/spreadsheets/d/1NiBkb0xwMvljLPG1e9wOStx71PFu9CwYdz7aDzuzDtA/export?format=pdf
More PDF Options
There are more options you can add to a PDF export URL. To add these options just add an ampersand between the options.
The end of a url might look like this
/export?format=pdf&size=1&fzr=false&portrait=true&fitw=true
and you can keep adding options of your choice.
Size
size=
Select a number between 1 and 10
size= paper size. 0=letter, 1=tabloid, 2=Legal, 3=statement, 4=executive, 5=folio, 6=A3, 7=A4, 8=A5, 9=B4, 10=B5
Repeat Row Headers
fzr=
Choose either true or false
Portrait or Landscape
portrait=
choose either true or false
When you select false that is landscape
fit window or actual size
fitw=
choose either true or false
true is Fit window, false is Actula size
Show Gridlines or Hide Gridlines
gridlines=
choose either true or false
True shows gridlines, while false hides gridlines.
Show Title in PDF
printtitle=
choose either true or false
Show Page Numbers or Not
pagenum=
Choose eitehr Center or Undefined.
CENTER = show page numbers
UNDEFINED = do not show page numbers
Attach to an Email
attachment = true/false
Leave this as true, but this type of selection can be used in Apps Script to send a pdf as an attachment in an email.
Sheet Id if you want a specific sheet
gid=
Add a SheetId for the sheet you want to create a pdf of.
The first sheet will be 0. others will have a unique ID.
Leave this completely off the url, for all sheets.
Export a Range from a google Sheet as a PDF
You will need all the below selections to export a range.
SheetID (as gid), Start Row, Start Column, End Row, and End Column.
Sheet ID
gid=sheetId
gid must be included. The first sheet will be 0. others will have a unique ID you can see in the url of your browser.
ir=false
This selection seems to be always false. As per tests.
ic=false
same as ir, always false.
Start Row
r1=
this must be the start Row number minus 1. Therefore row 1 would be 0 , row 15 would be 14, and you can do the math on the rest of them.
Start Column
c1=
This must be the start column number minus 1 . Therefore column 1 would be 0, column 2 would be 1, and so on and so on. You can do the math yourself.
End Row
r2=
This is the End Row number
End Column
c2=
This is the end column number
Check out the free tool by Better Sheets