It would seems I am stuck with a consistant "Server Encountered an Error" when I am trying in my function to use the insertRows() call or insertRowsAfter() and then do a getRange() operation call within the range of cells newly created (like changing the font weight, or setvalues in the new cells).
When I call my function I always get a google "Server Encountered and Error". When I call my function in debug mode, step by step: no errors!!! I have no error logs showing when doing a catch.
I tried a Spreadsheet.flush() call before the getRange() operation, not helping.
function test() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sdebtcal = ss.getSheetByName('Debt');
var max_rows = sdebtcal.getMaxRows(); // sheet set with only 5 rows to test
sdebtcal.insertRowsAfter( max_rows , 20); // adding 20 rows
sdebtcal.getRange(max_rows+5, 1, 2, 1).setFontWeight('bold'); // trying to setFontWeight in the new range of cells
}
我不得不说我尝试了一个空白电子表格,但我没有问题。仅使用我当前的大型电子表格。虽然测试表很小(要测试 2 行!)。此外,我没有达到电子表格上的任何最大单元格限制。
有人有提示吗?带有大型电子表格的电子表格脚本 API 可能存在错误?
问候,