Please anyone can help my? this is my code and throws We're sorry, a server error occurred. Please wait a bit and try again always. The idea is take a sheet generic and another sheet and copy all data from a sheet to generic sheet.
function importData(id){
try{
var sheet = SpreadsheetApp.openById(id);
Logger.log("name of sheet: " + sheet.getName())
var sheetToImport = sheet.getSheetByName("planilla para carga de datos");
var sheetGeneric = DocsList.getFileById('0ArvYhlthIEV-dGxLOTI1MG5OSkI2SzRGRDhlendwcnc');
var newSheet = sheetGeneric.makeCopy(sheet.getName()+" V2");
var row = sheetToImport.getRange('A:Z');
var range = row.getA1Notation();
var values = row.getValues();
var ss = SpreadsheetApp.openById(newSheet.getId()).getSheetByName("planilla para carga de datos");
Logger.log("Valores a insertar: " + values)
var valuesNewSheet = ss.getRange(range).getValues();
Logger.log("Rango: " + range + "valores del sheet antes: " + valuesNewSheet);
ss.getRange(range).setValues(values);
Logger.log("valores del sheet dsp: " + ss.getRange(range).getValues());
Logger.log("new id: " + ss.getId());
}catch(e){
Logger.log("error: " + e )
return;
}
return ss.getId();
}