This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |