admin管理员组文章数量:1245896
Overview:
I'm attempting to Copy a list of records from one sheet tab to another, in this case the Index tab to the All Work Orders tab. The data set contains 44 columns, and on average approximately 200 - 300 rows. The Goal of the apps script function provided, is to copy the list of rows from the origin (Index) tab, to destination (All Work Orders) tab.
Current issue:
When the function is run/executed, it starts copying the list of records but after a few minutes, I keep receiving the following error message: (exceeded maximum execution time) and the function/copy process stops mid execution. How can I resolve this error?
Further guidance is much appreciated. Thanks
function copyDatabase_25() {
var ui = SpreadsheetApp.getUi();
var response=ui.alert("Complete", "Are you sure?", ui.ButtonSet.YES_NO);
//checking the user response
if(response==ui.Button.NO)
{
return; //exit from this function
}
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Index");
var desinationsheet = ss.getSheetByName("All Work Orders");
var startRow = 2;
var numRows = sheet.getLastRow() - startRow + 1;
var startCol = 24;
var numCols = 44;
var startColTarget = 1;
var dataRange = sheet.getRange(startRow, startCol, numRows, numCols);
var data = dataRange.getValues();
var Copy = "Copy";
var firstEmptyRow = sheet.getRange("A2:AQ").getNextDataCell(SpreadsheetApp.Direction.DOWN).getRow() + 1;
var dataToCopy = data.filter(row => row[2] !== Copy);
desinationsheet.getRange(firstEmptyRow, startColTarget, dataToCopy.length, dataToCopy[0].length).setValues(dataToCopy);
ss.toast("Completed successfully")
}
本文标签: google sheetsHow do I resolve error script Exceeded maximum execution time (copy Rows)Stack Overflow
版权声明:本文标题:google sheets - How do I resolve error script Exceeded maximum execution time (copy Rows)? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740234732a2246257.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论