Learn How to Play an MP3 File in Google Sheets


Clicking the Play button on an MP3 file embedded in a Google Sheet plays the audio file.

In Google Sheets, you can include a link to any MP3 audio file, but when you click the link, the audio will not play. A button in your Google Sheet can, however, be added to play the MP3 file in a modal window when pressed.

Here’s a sample:

image credits: labnol

This software will open a modal window with an audio player when the Play button is clicked on the Google Drive audio files.

Add a Button for Playing Audio

Go to the Insert menu and select Create a New Drawing from the drop-down menu. After selecting a shape from the list, write some text and click Save, the button will be added to your Google Sheet.

Add the Player Script

Next, inside the Extension menu of Google Sheets, go to Script Editor and paste the following script.

const openAudioPlayer = () => {
  const cell = SpreadsheetApp.getActiveSheet().getActiveCell().getValue();
  const html = `<iframe src="${cell}" width="480" height="180" frameborder="0" scrolling="no"></iframe>`;
  const dialog = HtmlService.createHtmlOutput(html).setTitle('Play').setWidth(500).setHeight(200);
  SpreadsheetApp.getUi().showModelessDialog(dialog, 'Play Audio');

Switch to the Google Sheet you created, right click the Play button and assign the openAudioPlayer script to the button.

Audio Player in Google Sheets
image credits: labnol

To save your changes, simply click the “OK” button. A modal window will open when you click the Play button on the URL of an MP3 file in a Google Sheet cell.

When you click the Play button, make sure the cell holding the audio file link is active.


The format of the link should be https://drive.google.com/file/d/file-id>/preview if you are hosting the sound files in your Google Drive.

Leave a Comment