Set format as plain text

2019-03-06 23:38发布

问题:

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

回答1:

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 :



回答2:

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.