SheetRender Blog

Generate PDF From Google Sheets: From Menu to Script

By Josh ·

Google Sheets writes a PDF in three clicks, and the file that lands in your Downloads folder is usually not the one you wanted. Columns fall off the right edge, and page two opens with no header row above the numbers.

How do you generate a PDF from Google Sheets? For a one-off, use File > Download > PDF and fix the scale and the frozen rows in the settings pane before you export. For the same file over and over, request the spreadsheet's /export?format=pdf URL, or wrap that URL in an Apps Script that saves the result to Drive on a timer. When the page has to look like a designed document instead of a printed grid, none of those three help, and you want a template tool.

Generate PDF from Google Sheets: which job do you have?

Four different jobs arrive at this search, and only the first one is a menu item.

  • One PDF of the sheet, once. The download menu, below. Most people reading this are done in two minutes.
  • The same PDF, regenerated on demand or on a clock. The export URL, or an Apps Script wrapped around it.
  • A PDF that looks like a document somebody designed. An invoice on letterhead, or a certificate. A spreadsheet export cannot get there, and the fourth section is about what does.
  • One PDF per row, named after the person in the row. That is a mail merge, and it has its own guide: Google Sheets mail merge. The menu, the URL, and the script below all hand you one file no matter what you do to them.

Save a Google Sheet as a PDF from the menu

  1. Open the tab you want. If you only want part of it, select that range first.
  2. File > Download > PDF (.pdf). A settings pane opens over a preview.
  3. In the first dropdown, choose Current sheet, Workbook, or Selected cells.
  4. Set the paper size and the page orientation, then set the scale to Fit to width.
  5. Turn gridlines off unless the reader needs the grid.
  6. Under Headers & footers, tick Repeat frozen rows so the header survives onto page two.
  7. Export.

Steps 4 and 6 are the two that decide whether anyone can read the result. Google describes the same settings pane on its print from Google Sheets page (opens in a new tab), which is the place to check if a label has moved since.

The scale defaults to 100%, which prints columns at whatever width they happen to be. A sheet 14 columns wide spills onto a second sheet of paper carrying columns J through N and nothing else. Fit to width squeezes it. If that makes the type too small to read, the sheet wants landscape, or wants three of its columns hidden before export.

Note: Repeat frozen rows repeats frozen rows. If you never froze one, the tick does nothing and page two still starts mid-table. Freeze the header first with View > Freeze > 1 row, then come back.

The same pane carries headers, footers, and custom margins. If the tab name or the file name is printing in grey at the top of page one, that is Sheet name and Workbook title in the same Headers & footers section. Clear them before the file goes to a customer.

Where it breaks: nothing about this runs without you. There is one file at the end, whatever the range was, and the layout is a spreadsheet with the grid turned off. It is the right answer for a printout and the wrong answer for anything you have to do again next Monday.

Google Sheets to PDF from a URL

Every Google Sheets spreadsheet answers an export endpoint. Take the spreadsheet URL, cut everything from /edit onward, and append /export?format=pdf:

https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/export?format=pdf&gid=0&size=A4&portrait=false&fitw=true&gridlines=false&sheetnames=false&printtitle=false&fzr=true

Paste that in the address bar of a browser signed in to an account with access and a PDF downloads. No menu, no preview pane.

The query parameters are the print settings by another name:

ParameterWhat it does
format=pdfThe one that matters. csv, tsv, xlsx, and ods work on the same endpoint.
gid=0Which tab. Open the tab and read the gid off the address bar.
size=A4Paper size. letter, legal, A3, A5, B4, and B5 are among the other reported values, and numeric codes turn up in older examples.
portrait=falseLandscape.
fitw=trueFit to width, the same squeeze as the menu.
gridlines=falseDrops the cell borders.
sheetnames=false and printtitle=falseKill the tab name and the file name printed at the top.
fzr=trueRepeat frozen rows on every page.
r1, c1, r2, c2Export a rectangle rather than the whole tab: first row, first column, last row, last column, with the two start values counted from zero.

Margins have their own parameters (top_margin and its three siblings, in inches), and attachment=false renders the PDF in the browser instead of downloading it.

Google publishes no reference page for any of this. The parameter list above is community knowledge, reverse-engineered from what the Sheets front end sends and passed around Stack Overflow. Google's own Apps Script sample for generating PDFs (opens in a new tab) builds a URL out of a dozen of them, so this is not guesswork. Nobody there has promised to keep them working. Treat it as a sharp tool that might dull.

The documented alternative is File > Share > Publish to web, which Google writes up itself (opens in a new tab). It will publish one tab as a PDF at a link that does not need a signed-in account. You give up the parameters. You get a URL Google intends you to use.

Where it breaks: the export URL is still one file of one tab. It also inherits the sharing on the spreadsheet, so a link you paste into a team wiki gives a PDF to everyone who could already open the sheet, and a sign-in wall to everyone else.

Still, this is the version I bookmark. A row of parameters you tuned once beats walking the settings pane every time, and it is the only form of this that another program can call.

Export Google Sheets as PDF with Apps Script

Which is what the script does. Apps Script fetches that same export URL, using the running user's OAuth token for authorization, and drops the response into Drive as a file:

// Exports one tab as a PDF into a Drive folder.
// Set FOLDER_ID to the folder's id (the tail of its Drive URL) and
// SHEET_NAME to the tab name exactly as it appears on the tab.
function exportSheetAsPdf() {
  const FOLDER_ID = "YOUR_FOLDER_ID";
  const SHEET_NAME = "Summary";

  const ss = SpreadsheetApp.getActiveSpreadsheet();
  const sheet = ss.getSheetByName(SHEET_NAME);
  if (!sheet) throw new Error("No tab named " + SHEET_NAME);

  const params = [
    "format=pdf",
    "gid=" + sheet.getSheetId(),
    "size=A4",
    "portrait=false",
    "fitw=true",
    "gridlines=false",
    "sheetnames=false",
    "printtitle=false",
    "fzr=true"
  ].join("&");

  const url = "https://docs.google.com/spreadsheets/d/" + ss.getId() + "/export?" + params;
  const response = UrlFetchApp.fetch(url, {
    headers: { Authorization: "Bearer " + ScriptApp.getOAuthToken() }
  });

  const stamp = Utilities.formatDate(new Date(), ss.getSpreadsheetTimeZone(), "yyyy-MM-dd");
  DriveApp.getFolderById(FOLDER_ID)
    .createFile(response.getBlob().setName(SHEET_NAME + " " + stamp + ".pdf"));
}

Open the sheet, go to Extensions > Apps Script, paste, run once, and approve the authorization prompt. You get Summary 2026-08-27.pdf in the folder.

To make it fire without you, add a time-driven trigger. Four lines, run once from the editor:

function installWeeklyTrigger() {
  ScriptApp.newTrigger("exportSheetAsPdf")
    .timeBased().onWeekDay(ScriptApp.WeekDay.MONDAY).atHour(7).create();
}

atHour(7) means the hour beginning at seven, not seven o'clock. Apps Script picks a time inside that window and then keeps it from run to run, which is Google's documented behavior (opens in a new tab) for every time-driven trigger. For a snapshot of yesterday's numbers that is fine; for anything a person is waiting on, tell them the hour and not the minute.

There is a shorter version. DriveApp.getFileById(id).getAs("application/pdf") converts the file in one call with no URL and no token. The method takes a content type and nothing else, so orientation, range, and which tabs come along are all out of your hands. Fine for an archive copy, poor for anything a customer reads.

Where it breaks: the script runs inside your Google account and spends your account's quota. Any single execution is cut off at six minutes, and triggered scripts share 90 minutes of total runtime a day on a consumer account, 6 hours on Google Workspace (Google's quota table (opens in a new tab)). One tab a week never gets near that. A loop over 40 tabs, each one a fetch and a file write, is a different conversation, and it is the same ceiling every add-on on this page runs into.

The other thing to know before you commit: the script has no memory. Run it twice on Monday and you get two files with the same name in the same folder, because Drive allows that. Add a setTrashed on the old one, or put the timestamp in the name and live with the pile.

When the PDF has to look like a document

Everything above exports a spreadsheet. Turn off the gridlines and it is still a spreadsheet: your column widths, your fonts, and a page break wherever the paper ran out. If somebody asked for an invoice on letterhead, or last quarter's report with the logo where the designer put it, no combination of export parameters gets you there. The data has to be poured into a layout that exists somewhere else.

Three ways to do that, in rough order of effort.

A Google Docs template plus a script. Lay the document out in Google Docs with <<Name>> style placeholders, then have Apps Script copy it, swap the tags for cell values, and export the copy with getAs("application/pdf"). The spreadsheet to PDF post carries the working loop, so I am not repeating it here. It costs about twenty lines and a Docs file you now maintain.

An add-on that does the same thing without the code. Autocrat (opens in a new tab) is free, reads Google Sheets, merges into a Docs or Slides template, and runs on a time or form trigger. Form Publisher and Portant occupy the same ground. Autocrat and Form Publisher are Apps Script underneath, so the six-minute ceiling is theirs too; Portant runs the merge on its own servers against its plan's quota. Either way the output looks like the Docs or Slides file you tagged.

A renderer built for the job. Hosted tools take the layout as an input instead of asking you to rebuild it. Some import a PDF and let you overlay fields onto it, some reconstruct an example you upload. They cost money, and picking between them is a comparison rather than a paragraph: the eight-tool roundup has prices and limits for each. If the recurring version is what you need, a report pack per client every Monday, that shape is covered in automated PDF reports.

If you only ever need this once, none of the three is worth starting. Export from the menu, live with the spreadsheet look, and spend the afternoon on something else.

SheetRender, when the sheet feeds a document somebody designed

We make SheetRender, so this is the rung I am not neutral about.

The fit is narrow. Your sheet is a list where every row is somebody's invoice or somebody's certificate, and the layout it goes into already exists as a finished file. Instead of rebuilding that layout in Docs with <<tags>>, you upload the file itself, a PDF or a photo of a printed copy, and Claude works out where the fields sit and lines them up against your column headers. Point it at the Google Sheet and every run takes a fresh snapshot as it starts; uploading a .csv or an .xlsx is the other option. The mapping is yours to correct before anything renders. Out comes one PDF per row, file names taken from a column you nominate. If one of your columns holds an email address, each file can be sent to it as it is made.

The second reason to look at it is what the Apps Script section was really about: the job comes back every week, and nobody wants to own the code that does it. A schedule here is a form you fill in. Pick how often it fires, hourly through monthly, and each run reads the sheet as it stands that morning. Nothing executes inside your Google account, so the six-minute limit stops being a number you think about, and a run can be told to skip rows it already produced a file for, which is the duplicate problem from two sections up, settled with a checkbox. None of the scheduling is free. When I last looked, $19 a month bought 1,500 documents and exactly one live schedule, and $49 removed the schedule limit and let a run fire every 15 minutes. Current numbers are on the pricing page.

Where it breaks: the big one first. If what you want is your spreadsheet as a PDF, this is the wrong tool, and there is no plan that changes it. We do not have an export-my-grid button and are not trying to build one. Go back to the download menu at the top of this page, spend the two minutes, and get on with your day. For everybody still reading: the rebuild is an interpretation of your example, so read the first few files before you turn 300 loose, and whatever is cropped or skewed in what you uploaded comes back cropped or skewed. That interpretation happens at Anthropic, which means your column headers and the top few rows of the sheet travel there, truncated but real. If those rows are payroll or student records, that is a question for whoever owns the policy where you work, and the Autocrat route above answers it better by never leaving Google. Everything arrives as a PDF with no editable file behind it, and your spreadsheet learns nothing about the run.

The free tier stops at 50 documents a month, 2 templates, and 50 emails, with no scheduling at all and generated files cleared out after 30 days. A "Made with SheetRender" footer sits at the bottom of every page it produces, the first one included. So free will show you what the rebuild does to your layout. It will not clear a backlog.

Quick answers

How do I save a Google Sheet as a PDF? File > Download > PDF (.pdf), then in the settings pane set the scale to Fit to width and tick Repeat frozen rows before you press Export. That gives you one PDF of the current sheet, the whole workbook, or the cells you selected.

How do I automatically export Google Sheets to PDF? Put the export in an Apps Script and hang a time-driven trigger on it, like the twenty-odd lines above. The script fetches the spreadsheet's export URL and writes the PDF to a Drive folder on whatever schedule you set. If you would rather not own code, an add-on with a time trigger does the same job, and a hosted tool does it outside Google's quotas.

Can Google Sheets email a PDF automatically? Sheets on its own, no. An Apps Script can: take the blob from the export fetch and hand it to MailApp.sendEmail in its attachments array, on the same trigger. Autocrat and the other merge add-ons have email delivery built in. For one message per row with that row's own file, the mail merge guide is the page you want.

Why is my Google Sheets PDF cut off at the right edge? The scale is still at 100%, so the columns print at full width and the extras run onto their own pages. Set it to Fit to width, or switch to landscape and hide the columns nobody reads. Exporting a fixed rectangle instead of the whole tab fixes it too, and it is the fix that survives someone adding a column next month.

Which route for which job

  • Once, and a spreadsheet look is fine: File > Download > PDF. Two minutes.
  • The same export repeatedly, by hand or from another program: the /export?format=pdf URL with your parameters saved in a bookmark.
  • Unattended, on a clock, still spreadsheet-shaped: Apps Script with a time-driven trigger.
  • It has to look like a designed document: a Docs template with an add-on or a script, or a hosted renderer if nobody wants to maintain the template.
  • One file per row: that is a mail merge, and it is a different guide.

What decides this is who will be sitting at the keyboard when the file needs making, more than how the file should look. A person exporting a board pack twice a year should use the menu and ignore everything else on this page. A file that has to exist at 7am on Monday whether or not anyone remembers it needs a trigger behind it, and the moment there is a trigger, the six-minute ceiling and the duplicate-file problem become yours to think about. Free means you own those. The paid tools on this page are mostly selling you the right not to. Pick for the second Monday, not the first.

Ready to turn every row into its own polished PDF?

Free plan · No credit card required