I'm trying to add buttons to several rows that would either add or subtract value from the designated row. Here's an image to show you what I want to do.
Rows with plus and substract buttons
I've reached to this script:
function plusB1() {
ss=SpreadsheetApp.getActiveSpreadsheet()
s=ss.getActiveSheet()
var currVal=s.getRange("B1").getValue()
var plusVal= currVal +1
s.getRange("B1") .setValue(plusVal)
}
function minusB1() {
ss=SpreadsheetApp.getActiveSpreadsheet()
s=ss.getActiveSheet()
var currVal=s.getRange("B1").getValue()
var minusVal= currVal -1
s.getRange("B1") .setValue(minusVal)
}
Which does what I want, except only in the first row. I could repeat creating custom functions for each row, but it seems very inefficient to me. Is there a way to have a couple of functions that gathers info about which row this button was pressed at?