I'm setting up a budgeting spreadsheet using google sheets. I have written code so that when my budget is updated on the dashboard sheet, the historical budget on a separate sheet is updated.
I've got the following section of code working, which checks whether the cell that's been changed is in the correct region to be a budget figure.
The code then takes the budget value and budget category.
I then want to search column C in my 'Historical Budget' sheet for the correct category, search row 4 of this sheet for the relevant month and update the cell with the budget value.
var range=e.range
var row = e.range.getRow();
var col = e.range.getColumn();
var sheetname = e.range.getSheet().getName();
var ss = SpreadsheetApp.getActiveSpreadsheet(),
sheet = ss.getActiveSheet()
if (sheetname == "Dashboard"){
if(col == 3)
{
if(row>=9)
{
if(row<=40)
{
var budgetvalue = range.getValue();
var budgetcategory = sheet.getRange(row,col-1).getValue();
// For & If loops here
}}}
I'm new to google script coding, so I'm sure the code above isn't the most efficient. Please do let me know if anyone spots any glaring inefficiencies!
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire