Create PDF from one sheet in spreadsheet #tips #PDF
This code defines a function called conSheet() that exports a single sheet from a Google Sheets document as a PDF file. The function starts by defining the ID of the Google Sheets document ('1P9RKeReNmrY') and uses SpreadsheetApp.openById() to retrieve the corresponding spreadsheet object. It then retrieves an array of all the sheets in the spreadsheet using ss.getSheets(), and defines a variable sheetName with the name of the sheet to be exported ('quotes'). The function then uses a forEach() loop to iterate through each sheet in the spreadsheet. For each sheet, it checks whether its name is different from the sheet name to be exported. If so, it calls the hideSheet() method to hide the sheet from view. Next, the function retrieves the spreadsheet as a PDF file using ss.getBlob().getAs("application/pdf"), and sets the name of the file using .setName(). It then uses DriveApp.createFile() to create a new file in the user's Google Drive with the PDF blob. Finally, the function uses another forEach() loop to iterate through each sheet in the spreadsheet again, and checks whether its name is different from the sheet name to be exported. If so, it calls the showSheet() method to unhide the sheet. In summary, this code exports a single sheet from a Google Sheets document as a PDF file, by hiding all other sheets, exporting the sheet as a PDF, creating a file with the PDF blob, and then unhiding all the other sheets. Course content web development and web design courses with coding examples and source code for the lesson content. Source Code is available within my Github account. Lessons posted are designed to help students learn more about a specific topic related to modern web development and applying code. Laurence Svekis is a professional top selling course author having instructed over 1 Million students both online and in person. Laurence Svekis is a Google Developer Expert specializing in Google Workspace automation using Google Apps Script Code. Check out my Website for more details at https://basescripts.com/ Subscribe https://www.youtube.com/@LaurenceSvekisCourses Tags and Keywords #PDFcreator #GoogleSheets #PDFconversion #spreadsheet #fileconversion #GoogleDrive #coding #automation #tech #PDFfiles #programming #GoogleAppsScript #PDFexport #sheets #documentconversion #PDFoutput #PDFgenerator #webdevelopment #GAS #codingtips #PDFformat #PDFoutput #Gsuite #PDFtools #digitaltransformation #productivitytools #PDFmanager #GoogleWorkspace #PDFprocessing #codeexample #webapps #PDFmanipulation #PDFwriter #sheetselection #PDFexporter #GAScoding #PDFextractor #cloudcomputing #appscript #GASdevelopment #PDFconverter #GASforPDF #GoogleDocs #sheettoPDF #GAStricks #PDFsolutions #PDFsaver #PDFsaver #GoogleScripts #PDFgenerator #PDFautomation #PDFworkflow #sheetsPDF #sheetconverter #documentmanagement #GAScode #GoogleAPIs #GoogleDriveAPI #GsuiteforPDF #PDFsolutions #PDFtasks #PDFprocessing #filemanagement #automationtools #PDFdeveloper #PDFintegrations #PDFdesign #PDFscheduling #GoogleCloud #PDFconversiontool #GoogleWorkspaceforPDF #PDFmerge #GoogleAppsScripting #PDFmanagers #GASautomation #sheetmanipulation #PDFcreator #Gsuiteautomation #PDFformcreator #PDFmanipulator #documentautomation #PDFworkflowoptimization #PDFeditor #PDFmanipulationtools #PDFeditorial #PDFdocument #PDFmanipulationsoftware #PDFreader #PDFtext #PDFoptimizer #PDFextract #PDFformprocessing #PDFfiller #GsuiteAPIs #PDFdataconversion #PDFreporting #PDFedit #PDFcollaboration #PDFdocumentcreation #PDFenhancement #PDFgenerator #PDFtoExcel #GoogleWorkspaceAPIs
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.