Reputation: 563
I have a Google Sheet that I paste entire rows into from a different sheet. I then run a script that does a couple of things, including copying the format of the row above (so that the validation and date formats are added to the new row).
I've always done this with:
templateRange.copyTo(targetRange, {formatOnly:true})
In my definitions, templateRange
is:
var templateRange = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(rowAbove, 1, 1, 36)
And targetRange
is:
var targetRange = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(rowNumber, 1, 1, 36)
This approach has worked flawlessly for months. Even years.
But recently--with NO changes to the script--it's stopped working.
Anybody have any ideas what's gone wrong?
Upvotes: 0
Views: 1402
Reputation: 563
OK. I've solved my own problem. Turns out copyTo
with formatOnly:true
is still working fine. But that function is apparently no longer copying data validation or dates. To do that, I needed to use the DataValidation Class. Same story for the date. Pain in the knee. But at least I got my script operational again.
Upvotes: 1