What your working on is a copy of the sheet i really use. Go ahead and mess up whatever you want. lol
Okay, done. Here’s the modified function:
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('NoIP');
var headers = sheet.getRange(1,1,1,sheet.getLastColumn()).getValues();
var source_col_index = headers[0].indexOf('HTTP_up');
var target_col_index = headers[0].indexOf('Monitoring Since');
var data = sheet.getRange(2,1,sheet.getLastRow()-1,sheet.getLastColumn()).getValues();
var now = new Date();
data.forEach(function (row) {
var source_col_val = row[source_col_index];
if (source_col_val.match(/✅/) ) {
row[target_col_index] = now;
}
});
sheet.getRange(2,1,sheet.getLastRow()-1,sheet.getLastColumn()).setValues(data);
}
Working Great. I changed now to = whats in B3. Since the pi updates that cell. If the pi is offline then it cant see whats online. Thank you again.
Also added conditions for easy view.
Hi ThinDinh,
This is great! I was wondering if this could also be done in a GlideTable?
Thanks,
Daniel
If you want it for a checkbox, you would have to do it in an edit screen.
-
Create a user-specific column called “Checkbox temporary”. I’ll call the real checkbox column “Checkbox real” from this point.
-
Create a normal timestamp column to store the time of the change, let’s call it “Timestamp change”.
-
Create a button with the custom action being:
1st, set column: set the value of “Checkbox real” to “Checkbox temporary”.
2nd, show edit screen.
-
Add a switch pointing to “Checkbox temporary”.
-
Add an “on submit” action, only run it if “Checkbox temporary” is not the same as “Checkbox real”:
Set column: set the “current time” special value to the “Timestamp change” column, and set the “Checkbox temporary” value to the “Checkbox real” column.
This will work when you want to have a timestamp for specific changes to one column.
If you want multiple columns, then the flow might be harder. Let me know if you want that and we can brainstorm for a solution.