How to Export Google Sheets as a PDF

puneet-gogia-excel-champs

- Written by Puneet

Google Sheets has a lot of ways to export data from it, and one of the most common and popular formats is to export it as a PDF file. Now, PDF has a lot of benefits if you see it. You can share it with others quickly and open it anywhere (desktop or mobile).

Let’s say you use Google Sheets to track monthly sales in a small business. You need to share the sales report with your team and manager at the end of each month. Instead of sharing a Google Sheet file, you can save it as a PDF and then share it.

This ensures everyone sees the same data in the same layout. It’s also easier to print and looks more professional in meetings. Your team can check the sales data without worrying about making changes.

Save Google Sheets as a PDF File (Simple Steps)

The one thing I like about Google Sheets is that there is an option to export the worksheet as a PDF, and you do not need to use any plugin to export the worksheet as a PDF file. Below are the steps that you can use:

  1. Go to the File Menu: Click on the “File” menu at the top left corner of the Window.
  2. Select Download: Hover over “Download” in the drop-down menu to see more options.
  3. Click on PDF (.pdf): Click on “PDF Document (.pdf)” from the list of options.
  4. Apply Settings: A new window will open where you can adjust settings like page orientation and scale.
  5. Export: Click “Export” to save the PDF to your computer.

It is as simple as a few clicks. But you also have an option to create a

Customize Your PDF File Before Exporting

As seen in the steps above, you can customize it before downloading a Google Sheet as a PDF. You can customize several settings to ensure the document meets your needs.

1. Export

This is the first drop-down in the settings. From the ‘Export’ drop-down, you can specify if you want to export an entire worksheet, workbook, or the range selected as of now as a PDF file. This helps you have flexibility if you want to export all the data or a part of it as a PDF.

2. Paper Size

When exporting a Google Sheet as a PDF, you can choose the paper size to match your printing needs. Standard options include A4, Letter, and Legal. This setting helps ensure the content fits nicely on the page when printed.

3. Page Orientation

You can choose the page orientation to display your sheet data. There are two options: portrait and landscape. The portrait is for data with more rows, while the landscape is for wider tables with many columns. This helps your data fit neatly on the page. Select the orientation according to your needs before exporting the PDF.

4. Scale

With the scale option, you can adjust the scale to fit your data on the PDF. Scaling lets you shrink or enlarge your data to ensure everything fits nicely. For example, you can scale it down to fit more columns on one page or scale it up to make the text bigger.

5. Margins

Just like a printout on paper, you can set the margins to control the margins around your PDF. Well, margins are the blank areas along the edges of the page. You can choose normal, narrow, or wide margins according to your needs. Adjusting the margins can make your data easier to read and print.

6. Show Gridlines

Gridlines are light grey borders around the cells. You can add them by checking the option for “Show gridlines”. And if you want to hide the gridlines, you can uncheck it.

7. Show Notes

Notes are comments or extra information you’ve added to specific cells. To include them, check the option for “Show notes.” This will ensure all your notes appear in the PDF, providing additional details to the user.

8. Page Order

Page order fixes how your data from the sheet or workbook is arranged across multiple pages in PDF. You can select the order by “Down, then over” or “Over, then down”.

8. Alignment

To export data as a PDF, you can adjust the alignment of your worksheet. Alignment controls how your data is aligned on the PDF page—left, center, right, top, bottom, or center.

9. Headers and Footers

As you know, headers appear at the top of each page, and footers appear at the bottom. You can include page numbers, workbook titles, sheet names, dates, and times.

Heavy File Size While Exporting Google Sheets as a PDF

For several reasons, the file size can become large when exporting a Google Sheet as a PDF. Including high-resolution images or having a lot of images can increase the file size. Charts and graphs also add to the size.

Using conditional formatting, which involves multiple colors and rules, can make the file larger. Large data sets that need multiple pages can also make a file heavy. Embedded links and notes also increase the size because the PDF captures all these details.

To keep your PDF file size smaller, consider reducing the use of images, simplifying charts, limiting conditional formatting, and breaking large data sets into smaller sections.

If you have a large data set, you can create a summary table by creating a pivot table and then download it as a PDF. And make sure to delete blank rows and columns from the data to shorten its size.

Download Google Sheets as a PDF and Save to Google Drive

Here’s th Google App Script Code

function exportSheetAsPDF() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = spreadsheet.getActiveSheet();
  var sheetName = sheet.getName();
  var pdfOptions = {

    format: "pdf",
    portrait: false, // true for portrait, false for landscape
    size: "A4",
    scale: 1,
    top_margin: 0.5,
    bottom_margin: 0.5,
    left_margin: 0.5,
    right_margin: 0.5,
    gridlines: false, // Set to true to include gridlines
    printtitle: true,
    pagenumbers: true,
    attachment: false,
    gid: sheet.getSheetId(),
    fitw: true,
    access_token: ScriptApp.getOAuthToken()
  };
  var url = "https://docs.google.com/spreadsheets/d/" + spreadsheet.getId() + "/export?" + Object.keys(pdfOptions).map(function(key) {
    return key + "=" + pdfOptions[key];
  }).join("&");
  // Log the URL to use it for downloading
  Logger.log("Download URL: " + url);
  // Optional: Place the URL in a cell for easy access
  sheet.getRange("A1").setValue("Download PDF");
  sheet.getRange("A2").setFormula('=HYPERLINK("' + url + '", "Click here to download the PDF")');

}

With this code, you can generate a Google Drive link to download the worksheet as a PDF.

Last Updated: May 25, 2024