Google Sheets - Error "Cell Reference out of range" coming by email

Asked

Viewed 11 times

0

I just started writing my macros on google Sheets, so it may be that my codes have some very glaring errors and some redundant lines, but let’s go

Basically, I have an integration in integromat that takes data to my spreadsheet. Each new access on my site triggers a trigger that makes a column be added to my spreadsheet, filling the cells from column A to I. When a row is added to my spreadsheet, my macro is fired and it fills the columns from J to L, in the same new line added. In this case, everything is going well, the data is coming right, the cells are being filled and everything is ok. But even so, I keep getting several emails saying "Exception: Cell Difference out of range". Does anyone know where my script might be generating this error?

Follows the code:

function PreencherColunasDados () {

var DadosLeads = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Dados');

DadosLeads.getActiveCell();
DadosLeads.getRange('A1').activate();
DadosLeads.getCurrentCell().getNextDataCell(SpreadsheetApp.Direction.DOWN).activate();

var Linha = DadosLeads.getCurrentCell().getRow();

DadosLeads.getActiveCell().offset(0,9).activate()

DadosLeads.getCurrentCell().offset(-1, 0).activate();
var destinationRange = DadosLeads.getActiveRange().offset(0, 0, 2);
DadosLeads.getActiveRange().autoFill(destinationRange, SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
DadosLeads.getCurrentCell().offset(1, 0).activate();
  
DadosLeads.getActiveCell().offset(0,1).activate()

DadosLeads.getCurrentCell().offset(-1, 0).activate();
var destinationRange = DadosLeads.getActiveRange().offset(0, 0, 2);
DadosLeads.getActiveRange().autoFill(destinationRange, SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
DadosLeads.getCurrentCell().offset(1, 0).activate();
  
DadosLeads.getActiveCell().offset(0,1).activate()

DadosLeads.getCurrentCell().offset(-1, 0).activate();
var destinationRange = DadosLeads.getActiveRange().offset(0, 0, 2);
DadosLeads.getActiveRange().autoFill(destinationRange, SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
DadosLeads.getCurrentCell().offset(1, 0).activate();

}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.