Aim of the puzzle: Use Apps Script to complete the 2nd 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.
In this puzzle, you’ll complete the 2nd 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 2.
Add a for…of loop inside the
main() function declaration that iterates through every
values. Then, inside the for…of loop, create a variable called
copyId that stores the id returned by
makeCopy(contractId, row + ‘ Contract’). Finally, still inside the for...of loop and just below the copyId
variable declaration, printcopyId` to the console.