I am trying to copy cells with the value 0 into another cell. Can't seem to get the if statement to work.
function pushGeo()
{
var ssA = SpreadsheetApp.openById('###')
var ss = ssA.getSheetByName('thissheet');
var lastRow = ss.getLastRow();
for(var row=2;row<=lastRow;row++)
{
if(ss.getRange('G'+row).getValue() != 0){
var source = ss.getRange('G2:G'+lastRow);
var destination = ss.getRange('N2:N'+lastRow);
source.copyTo(destination);
}
}
Right now it's copying all cells into the new column.
== Ah, nevermind. I was silly with the range. Time to stop coding for the day.
function pushGeo()
{
for(var row=2;row<=lastRow;row++)
{
if(ss.getRange('G'+row).getValue() != 0){
var source = ss.getRange('G'+row);
var destination = ss.getRange('N'+row);
source.copyTo(destination);
}
}
Aucun commentaire:
Enregistrer un commentaire