PDF Output

How to Create Google Sheets PDF Reports with Apps Script

Google Workspace users often need to share spreadsheet insights as PDFs. With a small Apps Script helper and a bit of Excel VBA, you can automate the whole pipeline – from data preparation to final PDF output – without juggling manual exports or copy‑pasting. The approach stays within the familiar Google and Microsoft environments and keeps all files on your local machine or Drive.

Apps Script exports
Word + optional PDF
Photo-heavy reports
Local processing
7-day free trial on the 3-month plan • 14-day refund policy • Microsoft Word Desktop required • Local processing

Fast, repeatable PDFs

From rows to PDFs in minutes

Works with existing Sheets and Excel data See pricing

Quick answer

The simplest way to generate PDF reports from Google Sheets is to let Apps Script pull the sheet data, format it as needed, and export it as a PDF file. A small VBA macro can first export the relevant data from Excel as CSV, which the script then reads. The script creates the PDF, stores it in Drive, and optionally emails it. This combination removes the repetitive manual steps of opening the sheet, printing to PDF, and renaming files.

In plain English

Export your Excel rows to CSV, let Apps Script read that CSV, format the sheet, and call SpreadsheetApp.getAs('application/pdf') to produce a ready‑to‑share PDF.

Why this matters

Generating PDFs directly from spreadsheet data saves time, reduces human error, and provides a consistent look for every report. When the workflow is automated, updates to the source data instantly reflect in the next PDF without re‑creating templates. Teams that need to distribute regular performance or financial snapshots benefit from a repeatable process that lives inside the tools they already use.

Consistency across hundreds of reports

Because the script builds the PDF from the same source data each run, headings, footers, and image placements stay uniform. No more manually adjusting margins or fonts for each export.

Scalable to large data sets

A loop in Apps Script can process each row of a CSV file, producing a separate PDF for every record. The same macro can split a large Excel sheet into smaller CSV chunks, keeping memory usage low.

What goes wrong

A naïve manual export often breaks when the sheet contains images, custom formatting, or when the file name needs to match a naming convention. Users also hit limits when they try to run the same steps repeatedly – they forget to clean up old files, leading to clutter and version confusion.

Before automation

Open the sheet, choose File → Download → PDF, adjust export settings, rename the file, and repeat for each row. Any change in layout forces you to redo the whole process.

After automation

Run a single Apps Script function that reads the data, applies a predefined export configuration, creates a correctly named PDF, and saves it automatically. No manual clicks, no renaming errors.

Without a scripted approach, the workflow quickly becomes brittle – a single formatting tweak can break every subsequent export, and keeping track of generated PDFs turns into a manual filing nightmare.

What the workflow looks like

The end‑to‑end workflow stitches together a small Excel export macro and a Google Apps Script helper. First, Excel prepares the data in a format the script can ingest; then Apps Script creates the PDF and stores it where the team can access it.

Step 1

Export data from Excel

Run a VBA macro that writes the rows you need into a CSV file in a dedicated folder. The macro also ensures the folder exists and that any image paths referenced in the sheet are copied alongside the CSV.

Step 2

Trigger the Apps Script helper

Add a custom menu item in Google Sheets that calls the script, or set up a time‑driven trigger that runs daily. The script reads the CSV from Drive, parses each line, and writes the values into a hidden sheet used only for report generation.

Step 3

Format the hidden sheet

Apply any formulas, conditional formatting, or image placeholders required for the final layout. Because the sheet is hidden, users never see the intermediate steps.

Step 4

Export as PDF

The script calls SpreadsheetApp.getActiveSpreadsheet().getAs('application/pdf') with the desired export options (e.g., page size, orientation). The resulting Blob is saved to a target Drive folder with a name derived from the source row.

Step 5

Optional distribution

If needed, the script can email the PDF directly to a list of recipients, attach it to a Draft, or move it into a shared team folder for downstream processing.

A visual example

Simple visual illustration.

How to Create Google Sheets PDF Reports with Apps Script

AI-generated illustration for article.

A grounded VBA example

A short VBA macro can prepare the CSV file that Apps Script will later read. The macro also guarantees that any referenced images are placed alongside the CSV, making the Google side resilient.

VBA helper

The macro saves the active sheet as CSV, creates an "Images" sub‑folder, copies each picture used in the sheet, and writes a log file with the paths. This ensures the Apps Script has everything it needs in one place.

Sub ExportDataAndImages()
    Dim ws As Worksheet
    Dim csvPath As String, imgFolder As String
    Dim fso As Object, pic As Shape
    Set ws = ThisWorkbook.Sheets("ReportData")
    ' Ensure output folders exist
    csvPath = ThisWorkbook.Path & "\Export"
    imgFolder = csvPath & "\Images"
    Set fso = CreateObject("Scripting.FileSystemObject")
    If Not fso.FolderExists(csvPath) Then fso.CreateFolder csvPath
    If Not fso.FolderExists(imgFolder) Then fso.CreateFolder imgFolder
    ' Export sheet as CSV
    ws.Copy
    With ActiveWorkbook
        .SaveAs Filename:=csvPath & "\data.csv", FileFormat:=xlCSVUTF8
        .Close SaveChanges:=False
    End With
    ' Export each picture using Shape.Export (supported in recent Excel versions)
    For Each pic In ws.Shapes
        If pic.Type = msoPicture Then
            Dim imgPath As String
            imgPath = imgFolder & "\" & pic.Name & ".png"
            ' Export at 96 DPI; adjust as needed
            pic.Export Filename:=imgPath, Filter:=xlPNG, ScaleWidth:=0, ScaleHeight:=0
        End If
    Next pic
    MsgBox "Export complete. CSV and images ready in " & csvPath, vbInformation
End Sub

Run the macro before launching the Google helper; the generated files stay on your local drive, ready for the cloud script to pick up.

A small Google-side helper

On the Google side, a compact Apps Script reads the CSV, fills a template sheet, and exports a PDF. The script can be attached to a custom menu for on‑demand runs or scheduled via a trigger.

Apps Script helper

The script parses each CSV row, writes values into a hidden report sheet, applies formatting, and then creates a PDF Blob that is saved to a Drive folder with a meaningful name.

function generatePdfFromCsv() {
  var folderId = 'YOUR_DRIVE_FOLDER_ID'; // replace with your folder ID
  var csvFile = DriveApp.getFilesByName('data.csv').next();
  var csvData = Utilities.parseCsv(csvFile.getBlob().getDataAsString());
  var ss = SpreadsheetApp.create('TempReport');
  var sheet = ss.getActiveSheet();
  sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
  // Hide the sheet used for generation
  sheet.hideSheet();
  // Apply any formatting needed here (e.g., set column widths, insert images from folder)
  var pdfBlob = ss.getAs('application/pdf').setName('Report_' + new Date().toISOString() + '.pdf');
  DriveApp.getFolderById(folderId).createFile(pdfBlob);
  // Cleanup temporary spreadsheet
  DriveApp.getFileById(ss.getId()).setTrashed(true);
}

You can extend the script to email the PDF, move it to another folder, or log the operation status in a separate spreadsheet.

Where VBA starts to strain

While VBA excels at local data preparation, it starts to strain when you need to manage large images, complex conditional logic, or cross‑application automation beyond Excel and Word.

Image handling limits

VBA can copy images, but it cannot reliably resize them to PDF‑ready DPI without external libraries. Large batches of high‑resolution pictures can slow down the macro and increase memory usage.

Cross‑platform constraints

VBA runs only on Windows with Office installed. If team members use macOS or the web version of Excel, the macro will not execute, requiring a different preparation method.

Performance and maintainability

When a sheet contains dozens of embedded charts or pictures, the export loop can consume significant CPU time and cause occasional crashes. Maintaining a macro that manually copies each shape also adds overhead whenever the workbook layout changes, making the solution brittle over time.

A calmer way to standardize the workflow

If you want a fully cloud‑native, repeatable pipeline, consider moving the entire preparation step into Apps Script or Google Cloud Functions. This removes the Windows‑only dependency and lets the whole workflow stay inside Google Workspace.

DocxForge Pro 7 days free, then $38 every 3 months • 14-day refund after purchase

If PDF output is part of the workflow DocxForge Pro can generate the Word file first and handle PDF export inside the same local desktop process. Even when intake starts in Google Sheets the final document generation can still stay local in Excel Word and PDF.

This is useful when you need repeatable PDF output without moving files into a cloud workflow. This matters when the intake side is spreadsheet-based in Google but final controlled document output still needs Word and PDF. In a hybrid workflow the code examples can cover intake or preparation while DocxForge Pro remains the local document-generation layer for final Word/PDF output.

Start Free 7-Day Trial

All‑in‑Google solution

Store source data in Google Sheets, use Apps Script to generate PDFs, and automate distribution with Gmail. No local files, no VBA, and consistent behavior across all platforms.

Frequently asked questions

Common questions about turning Sheets data into PDFs

How can I create PDF reports from Google Sheets with Apps Script?

Add a custom menu that runs a function which reads your data (or a CSV uploaded to Drive), writes it to a hidden sheet, and calls SpreadsheetApp.getActiveSpreadsheet().getAs('application/pdf') with the desired export options. Save the resulting Blob to Drive or email it.

What usually breaks first in a spreadsheet‑driven script workflow?

Missing or mismatched file paths are the most common failure point. If the CSV references an image that isn’t in the expected folder, the script can’t embed it, leading to broken layouts. Always verify that the VBA macro copies images to the same folder as the CSV before the Apps Script runs.

When does a local workflow become easier than patching scripts?

If your team works mainly on Windows with Office installed and you need to pull data from legacy Excel workbooks, preparing a CSV locally with VBA is often quicker than migrating everything to the cloud. Once the data is in CSV, a tiny Apps Script can finish the PDF generation without further local steps.

A more repeatable way to handle this workflow keeps the heavy lifting where it belongs – either on the local machine you control or entirely in the cloud you trust. 7 days free, then $38 every 3 months • 14-day refund after purchase
Consistent file namingAutomatic image handlingZero manual PDF export stepsScalable to dozens or hundreds of reports
Start Free 7-Day Trial

Topics and Tags

Browse related topic clusters and workflow tags connected to this article.

PDF Output Google Sheets Google Apps Script Reports

Continue Reading

Explore more articles related to this workflow, problem, or document automation topic.