Here is I'm getting response from my app to google sheet. I don't want to miss any inquery from my staff so I would like to get notification sound on google sheet when row cell text updated/added.
here is used this apps script but not working for me
function playNotificationSound() {
var audio = new Audio("https://www.soundjay.com/buttons/sounds/button-1.mp3"); // URL to the sound file
audio.play();
}
function aEdit(e) {
var sheet = e.source.getActiveSheet();
if (sheet.getName() == "Staff") {
playNotificationSound();
}
}
function onEdit(e) {
var sheet = e.source.getActiveSheet();
var range = e.range;
if (sheet.getName() == "Staff" && range.getColumn() == 1 && range.getValue() !== "") {
// Trigger a notification message
Browser.msgBox("A new text has been added or updated in column A of the Staff sheet.");
}
}
function runEverySecond() {
//This function checkCalls() is triggered every second
setInterval(function() {
checkCalls();
}, 1000); // 1000 milliseconds = 1 seconds
}
window.onload = function () {
runEverySecond()
}
You only can register existing events...
Also you did not show us your updated autorefresh procedure, whjch should NOT use global variables
And if you want to use the Get method from the web component, you have to register a Web.GotText event as already mentioned...
Follow the usage tips in the itoo thread... start simple and learn from the experience