Converting Sheet data as a PDF file

You can create an application to convert Sheet data into a PDF file and store it in Drive, and return the PDF file's URL to the user:

In the Code.gs file, create the doGet function as listed here:

function doGet() { /* * This spreadsheet may not be active while this function * executes, so you cannot get access to active spreadsheet, * use open by id. * */ var ss = SpreadsheetApp.openById("[[ this spreadsheet id ]]"); var SheetData = ss.getSheetByName("Data"); var template = HtmlService .createTemplateFromFile("Template.html"); // Assign 'data' to the template object template.data = SheetData.getDataRange().getValues(); // Evaluate template object as html content var html = template.evaluate(); // Convert html ...

Get Learning Google Apps Script now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.