TriggerShelf

Recipe

Email a Google Sheet tab as a PDF on a schedule

Trigger: Time-driven, weekly or dailyServices: SpreadsheetApp, UrlFetchApp, MailAppMock-tested: Nov 2026

Exports one tab to PDF, names it with the date, and emails it to the address you set. Add a weekly trigger and the report arrives by itself.

Set it up

  1. Paste the script, set sheetName and to in SP, and save.
  2. Run emailSheetPdf once and approve the prompts (it asks for external request access).
  3. Triggers > Add trigger > emailSheetPdf > Time-driven > Week timer.

The script

/**
 * Email one sheet tab as a PDF on a schedule.
 * Add a time-driven trigger (weekly or daily) for emailSheetPdf.
 */
var SP = { sheetName: 'Report', to: 'you@example.com', subject: 'Weekly report', wide: true };

function emailSheetPdf() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName(SP.sheetName);
  var url = 'https://docs.google.com/spreadsheets/d/' + ss.getId() + '/export?format=pdf'
    + '&gid=' + sheet.getSheetId()
    + '&portrait=' + (SP.wide ? 'false' : 'true')
    + '&fitw=true';
  var response = UrlFetchApp.fetch(url, { headers: { Authorization: 'Bearer ' + ScriptApp.getOAuthToken() }, muteHttpExceptions: true });
  if (response.getResponseCode() !== 200) throw new Error('PDF export failed: HTTP ' + response.getResponseCode());
  var day = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), 'yyyy-MM-dd');
  var pdf = response.getBlob().setName(SP.sheetName + ' ' + day + '.pdf');
  MailApp.sendEmail({ to: SP.to, subject: SP.subject + ' ' + day, body: 'The report is attached.', attachments: [pdf] });
  return 'sent';
}
Test status. 2 of 2 automated checks pass, run Nov 2026 against simulated Google services. This recipe has not yet been run inside a live Google account. Test it on a copy of your sheet first.

What you should see

ToSubjectAttachment
you@example.comWeekly report 2026-11-14Report 2026-11-14.pdf

The email as it arrives. Sample values, not output from a real account.

Common errors and fixes

PDF export failed: HTTP 401 or 403
Re-authorize the script. The account running the trigger must be able to open the sheet.
The PDF is cut off
Set wide to true, or reduce the print range.
Exception: Cannot call SpreadsheetApp.getActiveSpreadsheet from this context
Use a script bound to the sheet, or open it by ID.

Permissions. Running this script asks you to grant Google permissions for the services listed above, to your own script. TriggerShelf never receives your Google data. See the permissions table. Google will show "Google hasn't verified this app"; that is expected for a script you paste yourself.