Skip to content Skip to sidebar Skip to footer

Google Script Next Cell In Column

Been scouring the internet but not found a solution Basically I am wanting to paste data in the next available row in a specific column. The column i want to paste into is H Exampl

Solution 1:

got it working in the end.. For those of you interested my code is below

function putInNextAvaibleRow() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sht = ss.getSheetByName('Test');     //Rename to your sheetvar row=1;                               //start row to loop throughvar col=8;                               //column you want to loop throughvarvalue=34567;                         //value you want to assign - can be a cell or anythingwhile(sht.getRange(row,col).getValue()!=""){
    row++;
  }

  sht.getRange(row,col).setValue(value);
  Browser.msgBox("Sheet is "+row+".");
}

Solution 2:

You can't access user's clipboard, Google drive API don't give this possiblity. But, you can put data in the next available row in a specific column. Here's the solution :

functionputInNextAvaibleRow(sheet,col,value) {
  var row=1;
  while(sheet.getRange(row,col).getValue()!=""){
    row++;
  }
  sheet.getRange(row,col).setValue(value);
}

Post a Comment for "Google Script Next Cell In Column"