0

I'm stuck! Am I missing a function or object or is there a reasonable workaround?

I'd like to copy a range from one sheet to another sheet within the same Google Spreadsheet, copying the merged state of the cells but not copying the Conditional Formatting rules.

As far as I can tell: the only way to copy the merged state is to include formatting in the paste (i.e. a full paste), which also pastes the conditional formatting rules. There is no programmatic way to interact with the conditional formatting rules at all, nor is there a way to get merged state without complex workarounds.

Is there a way to do it?

If not, I could replace the conditional formatting with an onEdit(e) to evaluate each cell after edit if the edit occurred within a specified range (but that's proving a pain) then do the full paste.

Rubén
  • 34,714
  • 9
  • 70
  • 166

1 Answers1

0

If I'm not misunderstanding your question, can you apply

.clearFormat()

to your pasted range, followed by

.merge()

https://developers.google.com/apps-script/reference/spreadsheet/range#merge

harshaw61
  • 63
  • 9
  • 1
    Thanks; that could remove conditional formatting and selectively merge cells but requires the entire source range to be evaluated for merged cells through complex workarounds like in [this thread](https://stackoverflow.com/questions/11025543/how-do-i-know-if-spreadsheet-cells-are-merged-using-google-apps-script) and then used to apply the merges in a loop. Since there's a paste mode for ONLY conditional formatting, I was hoping there was one (or a simple approach) to paste everything BUT conditional formatting. – DeepWaters Jun 12 '16 at 19:59