简体   繁体   中英

GAS Spreadsheet copyTo() Values

I am looking to implement a kind of "archive function" which takes a Google spreadsheet sheet and copy's it to an archive spreadsheet.

The script currently uses Sheet.copyTo(Spreadsheet) , which works absolutely fine for static sheets, but when cells contain formulas, when it copy's to the new spreadsheet, these formula references obviously break.

With Range.copyTo() there is the option to add advanced arguments for {contentOnly: true} , but I can't see a similar thing for Sheet.copyTo()

Does anybody know a workaround for this, or is the only way I am able to achieve this is to getValues() , getFormulas() ... And replicate the sheet in the new sheet?

Creating an array with data having .getDisplayValues() attributes and throw that to the new sheet. Simple :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM