0
votes

I have a spreadsheet which I'm using as a form. The user will enter data and then press a button to "submit" it. When the data is submitted, the sheet is copied (except for a few cells). The data is copied by creating a new spreadsheet and copying the values and format since copyTo won't work outside of the same spreadsheet. Is there a way to copy the headers and footers too? Or at least a way to set them using the script?

1
This questions is better-suited for StackExchange's WebApps site: webapps.stackexchange.comRichie Thomas
@noogui Besides Range.copyTo methods there is Sheet.copyTo tooRubén

1 Answers

0
votes

Consider using the Drive Service to (1) get the file using getFileById("your file's id"), then (2) copying it using makeCopy(destination)

If you wish, after that you can select the second file right away because makeCopy() returns the new file. To do that, get its id with getId(), then select it with the Spreadsheet Service using openById(id). Now that the new file is selected, you can edit it with Apps Script.