Skip to content

Instantly share code, notes, and snippets.

@chemiadel
chemiadel / ExportAndEmailCustomSheetsAsPDF.gs
Last active March 22, 2023 01:26
Script export and send email of custom sheet on PDF for Google Sheets with GAS
//https://gist.github.com/chemiadel/bee4cb03481b580275d5296a3e7adc0d
function EmailPDF() {
//Get Active Spreadsheet
var spreadSheet=SpreadsheetApp.getActiveSpreadsheet();
//Get All Sheets of the spreadsheets
var sheets=spreadSheet.getSheets();
//Sheet wanted to export on PDF
@rheajt
rheajt / Code.gs
Created August 1, 2017 08:16
examples of simple triggers with google apps script
/**
* These simple triggers are available in Sheets, Docs, and Forms
* Most of this information can be found:
* https://developers.google.com/apps-script/guides/triggers/events
*/
function onOpen(e) {
// {
// authMode: 'LIMITED',
// source: 'Spreadsheet' || 'Document' || 'Form',
// user: 'User'
@primaryobjects
primaryobjects / Code.gs
Last active January 16, 2023 16:48
Export a Google Drive spreadsheet to PDF in Google Drive in the same folder.
// Simple function to add a menu option to the spreadsheet "Export", for saving a PDF of the spreadsheet directly to Google Drive.
// The exported file will be named: SheetName and saved in the same folder as the spreadsheet.
// To change the filename, just set pdfName inside generatePdf() to something else.
// Running this, sends the currently open sheet, as a PDF attachment
function onOpen() {
var submenu = [{name:"Save PDF", functionName:"generatePdf"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu('Export', submenu);
}
@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active March 21, 2024 00:43
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped