0

I'm trying to run a script on Google Sheets that sends the contents of I6 to the first empty cell Column G in different sheet within the same spreadsheet. So far I've managed to send the contents to Column G, but it shows up at the bottom of the column G or at the first empty row of the spreadsheet in Column G.

This is the script I'm using:

function SubmitData01() {
  var ss        = SpreadsheetApp.getActiveSpreadsheet();
  var formSS    = ss.getSheetByName("Input"); 
  var datasheet = ss.getSheetByName("Trades");
  
  var values = [[formSS.getRange("I6").getValue()]];
  
  datasheet.getRange(datasheet.getLastRow()+1, 8, 1, 1).setValues(values);
  
  formSS.getRange('C6:F6').clearContent();

}

Can you please fix this for me? I've tried fixing it myself, going through other similar questions and trying out random stuff (again, I have no idea what I'm doing), but of course, I have failed.

Lucy C
  • 111
  • 3
  • Tried `appendRow()`? – TheMaster Oct 01 '22 at 20:41
  • Thanks for your reply! Would you mind explaining what I need to further? I'm a complete noob. Do you mean replacing "getLastRow" with"appendRow"? – Lucy C Oct 01 '22 at 20:43
  • Search documentation for samples. See [tag info page](https://stackoverflow.com/tags/google-apps-script/info) for official documentation, free resources and more details. – TheMaster Oct 01 '22 at 21:26

0 Answers0