I want to create a script function that I will use with daily triggers:
- function will subtract "Daily Fees" (a cell value that changes daily from "Open Trades" sheet) / from "Cash" (a cell in another sheet "Dashboard") and will set the value of the remaining Cash in the same cell (Cash from Dashboard)
Formula -> 'Dashboard'!O5 = 'Dashboard'!O5 - 'Open Trades'!M4
I'm very new to script and Here is my best try:
function substract(){ var ss = SpreadsheetApp.getActiveSheet(); var dash = ss.getSheetName('Dashboard'); var a = dash.getRange("O5").getvalue; var cash = ss.getSheetName('Open Trades'); var b = cash.getRange("M4").getvalue; dash.getRange("O5").setvalue(a-b); }However this gives me this error:
Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Sheet.getSheetName.substract @ Daily Fees.gs:3