This class allows you to create, search, and modify files and folders in your Drive.
For reference documentation on the DriveApp
class, refer to the website: https://developers.google.com/apps-script/reference/drive/drive-app?hl=en.
Imagine that you need to create customized PDF files from the Sheet or external data. We can create PDF files from the HTML template. You simply need to format column headers and put some sample data in a new Sheet (AddressBook
) as shown in the following screenshot:
Create the createPdfs
function in the Code.gs
file as listed here:
function createPdfs(){ // 0 based column numbers const NAME = 0; const TITLE = 1; const COMPANY = 2; const ADDRESS = 3; const CITY = 4; const ZIP_PIN = 5; /* Get data from the sheet */ var sheet = SpreadsheetApp.getActiveSheet(); var data = sheet.getDataRange().getValues(); /* * Alternatively you can get data * from an external CSV file or anything else....