Aim of the puzzle: Use Apps Script to complete the 1st of 3 steps in writing a function to automate contract creation.
Walk through of the solution: For the last topic of this course, you’ll use Apps Script to create a function that automates the process of creating contracts. You’ve already written 2 helper functions that will be used in the main function.
In this puzzle, you’ll complete the 1st of 3 steps in the main function.
The main function has been divided into 3 steps:
Open a spreadsheet and get a range of values
Loop through every row in the range and call
makeCopy()to create and name a new copy of the contract
Open each copy and use
updateDoc()to replace its placeholder text with text from the spreadsheet
To complete the puzzle, complete step 1.
main() function declaration, create a variable called
sheet1 that stores the spreadsheet accessed by
SpreadsheetApp.openById(spreadsheetId). Then, create another variable called
values that stores the values returned by
sheet.getRange("A2:C5").getValues(). Finally, print
values to the console.
Apps Script concepts: