I'm brand new to java & scripting in Google Sheets & this is my first question on here, so any etiquette tips are appreciated.
I have been learning so much from this site, but I've been stuck on this simple error for weeks now & finally just have to ask since I can't find a solution anywhere.
EDIT to Hopefully be More Clear
I have a sheet with pricing in column "U" with formulas in columns "V" & "W" that change according to the value in "U". I created a button & attached a script that I would like for it to add the value of each cell in V to the value in W of the same row, for one iteration each time I select the button, & returning the new values in the same cell of column W.
function sumColumns(){
var spreadsheet = SpreadsheetApp.getActive();
var currentRow = spreadsheet.getDataRange().getLastRow(); //Get the last row with value on your sheet data as a whole to only scan rows with values
for(var x =2; x<=currentRow; x ){ //Loop starts at row 2
if(spreadsheet.getRange("V" x).getValue() == ""){ //Checks if V (row# or x) value is null
Logger.log("Cell V" x " is empty"); //Logs the result for review
}
else{
var res = spreadsheet.getRange("V" x).getValue() spreadsheet.getRange("W" x).getValue(); //SUM of V & W values
spreadsheet.getRange("W" x).setValue(res); //Replace W value with "res"
}
}
}