The Definitive Guide: How to Create PDFs from Google Sheets (From Simple Export to Full Automation)

Are you trying to figure out how to turn your Google Sheet into a PDF? Perhaps you’ve even searched for a “Google Sheets PDF function,” hoping for a simple formula.

Let’s clear that up first: Google Sheets does not have a built-in PDF() function.

But don’t let that stop you. There are powerful ways to achieve your goal, whether you need a quick, static copy or a fully automated system that generates hundreds of personalized documents.

In this definitive guide, we’ll cover both methods. We’ll start with the simple, one-click export and then dive into the holy grail: using Google Apps Script to put your PDF generation on autopilot.

create-pdf-from-google-sheets-guide-thodigitals-1
How to Create PDFs from Google Sheets easily

Method 1: The Standard ‘Export as PDF’ (For Quick, Static Files)

This is the most straightforward method and is built directly into Google Sheets. It’s perfect when you just need a single, non-editable copy of your spreadsheet.

How It Works

This feature generates a downloadable PDF version of your current spreadsheet. You have several options to control the output, such as paper size, orientation, and which cells to include.

Step-by-Step Guide:

  1. Open your Google Sheet.
  2. Navigate to File > Download > PDF document (.pdf).
  3. An “Print settings” window will appear. Here you can customize:
    • Export: Choose to export the current sheet, the entire workbook, or only selected cells.
    • Paper size & Page orientation: Standard options like A4, Letter, Portrait, or Landscape.
    • Formatting: Control gridlines, notes, and alignment.
    • Headers & footers: Add page numbers, workbook titles, or custom text.
  4. Click the blue “Export” button in the top-right corner. Your PDF will be generated and downloaded.

Pro-Tip: Create a Direct Download Link

You can create a special link that forces a PDF download of your sheet. Simply take your sheet’s URL, replace /edit at the end with /export?format=pdf.

  • Original URL: https://docs.google.com/spreadsheets/d/SHEET_ID/edit#gid=0
  • Download Link: https://docs.google.com/spreadsheets/d/SHEET_ID/export?format=pdf

This is incredibly useful for dashboards or reports where you want to give users an easy way to download the current version.

  • Advantages: The PDF format ensures your document looks the same on any device and prevents viewers from making edits.
  • Limitations: The exported file is static and not interactive. Any updates made to the Google Sheet will require you to generate a new PDF.
  • Best For: Perfect for distributing static reports, tables, invoices, or any finalized document.

Method 2: Bulk Generate PDFs Automatically with Google Apps Script (The Ultimate Solution)

The standard export is great for one-off tasks. But what if you need to create 100 personalized invoices? Or 500 unique event certificates? Manually exporting each one is not an option.

This is where the true power lies. By using a little bit of code, you can create a system that reads data from your Google Sheet and automatically generates a unique PDF for each row.

Real-World Use Cases:

  • Business: Automatically generate and email custom invoices or quotes to a list of clients.
  • Education: Automatically create and send course completion certificates to students.
  • HR: Automatically generate personalized monthly performance reports for each employee.

The Complete Step-by-Step Guide to Bulk PDF Generation

Don’t be intimidated by the word “code.” Just follow these steps carefully, and you’ll have a powerful automation system up and running.

Step 1: Prepare Your Template in Google Docs

First, we need a “blueprint” for our PDF. Google Docs is the best tool for this because it’s easy to format.

  1. Create a new Google Doc. This will be your template.
  2. Design your document (e.g., an invoice).
  3. For every piece of data you want to pull from your spreadsheet, use a placeholder with curly braces: {{variable_name}}.
    • Example: “Dear {{Customer Name}}, here is your invoice for {{Total Amount}}.”

(Note: This is a placeholder for a visual aid)

Step 2: Set Up Your Data in Google Sheets

Create a new Google Sheet. The column headers must exactly match the variable names in your Google Doc template, but without the curly braces.

Customer Name Email Invoice Number Total Amount
John Doe john@example.com INV-001 $500
Jane Smith jane@example.com INV-002 $750

Step 3: Write the “Magic” with Google Apps Script

  1. In your Google Sheet, go to Extensions > Apps Script. A new browser tab will open with the script editor.
  2. Delete any existing code and paste the following code into the editor.
  3. Crucially, you must customize the first 3 lines.
// 1. REPLACE with your Google Docs template ID
const TEMPLATE_ID = "YOUR_TEMPLATE_ID_HERE";

// 2. REPLACE with the ID of the folder where you want to save the PDFs
const DESTINATION_FOLDER_ID = "YOUR_FOLDER_ID_HERE";

// 3. REPLACE with the name of the sheet that contains your data
const SHEET_NAME = "Sheet1";

function generatePdfs() {
  const templateFile = DriveApp.getFileById(TEMPLATE_ID);
  const destinationFolder = DriveApp.getFolderById(DESTINATION_FOLDER_ID);
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME);

  // Get all data from the sheet, skipping the header row
  const data = sheet.getRange(2, 1, sheet.getLastRow() - 1, sheet.getLastColumn()).getValues();

  // Get header row to use as keys
  const headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];

  data.forEach(rowData => {
    // Create a new copy of the template for each row
    const newFile = templateFile.makeCopy();
    const doc = DocumentApp.openById(newFile.getId());
    const body = doc.getBody();

    // Replace all placeholders with data from the current row
    headers.forEach((header, index) => {
      body.replaceText(`{{${header}}}`, rowData[index]);
    });

    doc.saveAndClose();

    // Create the PDF
    const pdfBlob = newFile.getAs('application/pdf');

    // Use data from a specific column (e.g., Invoice Number) for the filename
    const invoiceNumber = rowData[headers.indexOf("Invoice Number")]; // Assumes you have an "Invoice Number" column
    const pdfFile = destinationFolder.createFile(pdfBlob).setName(`Invoice-${invoiceNumber}.pdf`);

    // Delete the temporary Google Doc copy
    DriveApp.getFileById(newFile.getId()).setTrashed(true);
  });

  SpreadsheetApp.getUi().alert('PDFs have been generated successfully!');
}

Step 4: Run the Script and Grant Permissions

  1. Click the Save project icon (looks like a floppy disk).
  2. Click the “Run” button.
  3. The first time, Google will ask for authorization. This is normal.
    • Click “Review permissions”.
    • Choose your Google account.
    • You may see a “Google hasn’t verified this app” screen. Click “Advanced” and then “Go to (your project name) (unsafe)”. This is safe because it’s your own code.
    • Click “Allow”.
  4. The script will now run. Go to your designated Google Drive folder to see the magic happen!

[⭐ The Time-Saving Solution] Get Our Pre-Built PDF Generator Template

Does the idea of handling code and IDs seem overwhelming? Do you want a polished solution that just works, right now?

We’ve done the hard work for you. At Thodigitals, we’ve developed a production-ready Bulk PDF Generator Template that packages this entire workflow into a user-friendly interface.

  • Zero Coding: No need to touch the script editor.
  • Simple UI: Just paste your data, your template ID, and click a button.
  • Bonus Features: Includes options for automatically emailing each PDF.
  • Full Support: Get help directly from our team if you get stuck.

[Click Here to Get the Automated PDF Template and Save Hours of Work]


Frequently Asked Questions (FAQ)

  • Q: Can I customize the name of the PDF files?
    • A: Yes. In the script, the line setName(...) controls the filename. You can combine data from different cells to create a unique name. Our template has a simple field for this.
  • Q: How do I find the ID for my Google Doc and Folder?
    • A: Look at the URL. For a Google Doc, it’s the long string of characters in .../document/d/THIS_IS_THE_ID/edit. For a folder, it’s .../folders/THIS_IS_THE_ID.
  • Q: What are the limitations of Google Apps Script?
    • A: Google has daily quotas. For a free Gmail account, a script can run for a maximum of 6 minutes per execution, and there are limits on how many emails you can send per day. These limits are much higher for Google Workspace accounts.

Conclusion

Your search for a “Google Sheets PDF function” has unlocked two powerful methods.

  1. For quick, static documents, the built-in File > Download > PDF option is your best friend.
  2. For scaling your work and automating repetitive tasks, Google Apps Script is the ultimate solution.

Mastering these techniques can transform your workflows, save you countless hours, and professionalize your documents. Start by trying the script above, or accelerate your success with our ready-to-use template.

Updated at: 12:30 PM , 14/07/2025

Leave a Reply

Your email address will not be published. Required fields are marked *