A
A
andrjuwka2022-01-15 23:09:49
Google Apps Script
andrjuwka, 2022-01-15 23:09:49

How to make the increment function on a button in a cell that corresponds to today's date?

there is a button. Added increment script by 1
function increment() {
SpreadsheetApp.getActiveSheet().getRange('C5').setValue(SpreadsheetApp.getActiveSheet().getRange('C5').getValue() + 1);
}

there is a column with dates (let's say A1-A30) . What should be added to the code so that it does not +1 cell C5, but the cell to the right of the date (B1-B30). And every new day, changes occurred in the cell corresponding to today's date.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2022-01-16
@andrjuwka

1) Get the data B1:C30 (getValues)
2) Loop through them, check:
3) If the date matches, then add 1 in this line
4) Unload the received data back (setValues)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question