playing sound with google script

google sounds
google assistant sound effect
google apps script
google sheet script
google apps script reference
google sheets
google docs audio
record audio in google docs

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
var SIDEBAR_TITLE = 'Sidebar Musicbox';

/**
 * Adds a custom menu with items to show the sidebar and dialog.
 *
 * @param {Object} e The event parameter for a simple onOpen trigger.
 */
function onOpen(e) {
  DocumentApp.getUi()
      .createAddonMenu()
      .addItem('Show sidebar', 'showSidebar')
      .addToUi();
}

/**
 * Runs when the add-on is installed; calls onOpen() to ensure menu creation and
 * any other initializion work is done immediately.
 *
 * @param {Object} e The event parameter for a simple onInstall trigger.
 */
function onInstall(e) {
  onOpen(e);
}

/**
 * Opens a sidebar. The sidebar structure is described in the Sidebar.html
 * project file.
 */
function showSidebar() {
  var ui = HtmlService.createTemplateFromFile('Sidebar')
      .evaluate()
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setTitle(SIDEBAR_TITLE);
  DocumentApp.getUi().showSidebar(ui);
}
Sidebar.html
<!-- Use a templated HTML printing scriptlet to import common stylesheet -->
<?!= HtmlService.createHtmlOutputFromFile('Stylesheet').getContent(); ?>

<div class="sidebar branding-below">
    <p>
    A little music for your enjoyment!
    </p>
    <audio id="player" controls>
      <source src="http://ukulelehunt.com/wp-content/uploads/2008/11/alohadechocobo.mp3" type="audio/mpeg">
      Your browser does not support the audio element.
    </audio>
    <div id="sidebar-status"></div>
</div>

<div class="sidebar bottom">
  <span class="gray branding-text">Docs Add-on Sound Demo</span>
</div>
Stylesheet.html
<!-- This CSS package applies Google styling; it should always be included. -->
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">

<style>
#player {
 width: 95%;
}
</style>

How do I insert audio on a Google Sheet?, r/googlesheets: A subreddit for collaborating and getting help with Google Sheets​. Unofficial. The sound library contains categorized sounds that you can use to enhance the user experience and increase the polish of your actions. Google hosts these sounds for you, so all you need to do is

sure - this works

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
  <audio id="audio_01" controls autoplay hidden="hidden">
  <source src="SHAKUHACHI_Masayuki_Koga_trim_mono-IMi00aV1tdA.mp3" type="audio/mpeg">
      Your browser does not support the audio element
    </audio>

    <script>

    var my_audio_01 = document.getElementById("audio_01");

    my_audio_01.play()

    </script>
  </body>
  </html>

or this simpler version also works

<body>
  <audio controls autoplay hidden="hidden">
    <source src="SHAKUHACHI_Masayuki_Koga_trim_mono-IMi00aV1tdA.mp3" type="audio/mpeg">
      Your browser does not support the audio element
  </audio>
</body>

Playing sounds? : googlesheets, function playAudio(assistant) { let text_to_speech = '<speak>' + 'I can play a sound' + '<audio src="https://actions.google.com/sounds/v1/alarms/  Open the Google Play Store app . Search for "Google". If it's not already installed, tap Install. Once you have the Google Search App: On your device, touch and hold the Home screen. Tap Widgets.

Sound Library | Conversational Actions, Play a sound when a cell in column H changes to "Call" on the sheet "Support". This function will need to run every 5min. Does the sound need  Autoplay When autoplay is enabled, a suggested video will automatically play next. Up next How to add audio to Google Slides and share it in Google Classroom - Duration: 6:11.

Recording .mp3 audio in Google Add-ons/Google Apps Script to , Having previously played around with WebRTC I knew capturing audio from the browser was possible but hadn't looked at processing it. As it  Configuring Google Drive to Play Audio Files Natively - Duration: 2:11. Eric Callis 27,302 views

Applying Conditional Formatting (with sound), The equivalent to Excel VBA is Google Apps Script which is based on JavaScript. Unfortunately they don't include a class for sounds. Play Music Directly from Google Drive Log in to your Google Drive and find the music file you want to play and right-click it. In the menu that comes up, click “Open with” and then the “Connect

How to set Audio alert in Google spreadsheet that triggers by a , Sound player console and background music scripts for HTML websites or web templates. Includes fallback code for older browsers. See Also… Sell mp3  Free radio for everything you do. Store 50,000 tracks from your personal collection. Subscribe for on-demand access to 40 million songs and offline listening.