Is there an easy way to incorporate a sound file into a Google Apps Script? I have seen a posting to try the following:
var audio = new Audio("alert.ogg");
audio.play();
I get the error:
ReferenceError: "Audio" is not defined
Is there an easy way to incorporate a sound file into a Google Apps Script? I have seen a posting to try the following:
var audio = new Audio("alert.ogg");
audio.play();
I get the error:
ReferenceError: "Audio" is not defined
Here's a simple example that embeds a music player into a document sidebar:
Code.gs
Sidebar.html
Stylesheet.html
sure - this works
or this simpler version also works
To actually play an audio file with google script, and not just open a sidebar with a music player in it (which needs the user to activate the play button), you could add the following to Mogsdad's answer:
To make the audio play automatically, replace this in the html file:
with this:
To make the sidebar close automatically when the audio finishes playing add this to the html file:
And replace the 3000 with the time in milliseconds your audio needs to play.
It would be great to be able to automate the opening of the sidebar, be it with a time trigger or with a formula in a cell. If anybody knows how to achieve this, please share.