I have the following which I got from a forum, which works really but I only want the first sheet created in PDF and Emailed, currently, the whole file is been sent in the .pdf form.
I have tried a few options, but as I am sure you can see, I am no coder. Any help would be really appreciated.
function sendSheetToPdfwithA1MailAdress() { // this is the function to call
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getSheets()[0]; // it will send sheet 0 which is the first sheet in the spreadsheet.
// if you change the number, change it also in the parameters below
var shName = sh.getName()
sendSpreadsheetToPdf(0, shName, sh.getRange('C12').getValue(), "Shoalhaven Hotwater & Elements", "Hi, Please see attached Purchase Order - Shoalhaven Hotwater & Elements");
}
function sendSpreadsheetToPdf(sheetNumber, pdfName, email, subject, htmlbody) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var spreadsheetId = spreadsheet.getId()
var sheetId = sheetNumber ? spreadsheet.getSheets()["Purchase Order Form"].getSheetId() : null;
var url_base = spreadsheet.getUrl().replace(/edit$/, '');
var url_ext = 'export?exportFormat=pdf&format=pdf' //export as pdf
+
(sheetId ? ('&gid=' + sheetId) : ('&id=' + spreadsheetId))