I am using Google Script to copy content of one Google Sheet to another sheet. I am using the following code.
function copySheet()
{
// open the spreadsheets where the data will be stored
var sourceTable = SpreadsheetApp.openById("SheetID"); // source spreadsheet
var srcSheet = sourceTable.getSheetByName("RawData");
var targetTable = SpreadsheetApp.openById("SheetID"); // target spreadsheet
var tarSheet = targetTable.getSheetByName("Sheet3");
// get the last row in the source sheet
var lastRowSource = srcSheet.getLastRow();
var lastCol = "L";
//read the source into an array
var aSrc = srcSheet.getRange("A1:" + lastCol + lastRowSource).getValues();
//save src array to destination
tarSheet.getRange("A1:" + lastCol + lastRowSource).setValues(aSrc);
}
The Script ran perfectly the first time but now is throwing the Service Time Out Error. Is there a way I can make it more efficient? The data is somewhat large ( around 25000 rows and 12 columns).