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.