0

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?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
doebtown
  • 553
  • 3
  • 10
  • 21
  • Is it still failing? I tried it and worked for me. I also tried with this function: https://developers.google.com/apps-script/reference/spreadsheet/range#copyFormatToRange(Sheet,Integer,Integer,Integer,Integer) – Gerardo Nov 19 '15 at 22:27

1 Answers1

1

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.

doebtown
  • 553
  • 3
  • 10
  • 21