-1
function A1format() {
 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var mainsheet = ss.getSheetByName("Sheet1");
 var G = mainsheet.getRange("C15:BH3000").getGridId();
 var illa = mainsheet.getRange("A13");

 Logger.log(G);
 illa.copyFormatToRange(G, 16, 3,200, 30);
 }

This doesnt Work and gives some strange Server error. Please help

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

2 Answers2

1

It seems that your col, colEnd and row, rowEnd values are not valid. The format of the copyFormatToRange function is:

copyFormatToRange(gridId, column, columnEnd, row, rowEnd)

// So in your case: column, columnEnd, row, rowEnd
copyFormatToRange(G,   3,      16,      30, 200);

If it's not helping - please add more details about the errors you are getting and make sure that the gridId is correct.

Ido Green
  • 2,795
  • 1
  • 17
  • 26
0

ldo Green answer above is right : in your code the end row is smaller than the start row...(columns are wrong too but it strangely accept this small negative difference) this is indeed not valid.

Using the autocomplete feature in the editor will remind you the parameters as follows :

enter image description here

Serge insas
  • 45,904
  • 7
  • 105
  • 131
  • 1
    Thank you for accepting but the other answer was first... I added mine to mention the auto complete tip. I'd suggest you mark the other one as best. – Serge insas Sep 28 '14 at 15:45