GUIDE

Google Sheets text to speech: turn every row into an MP3

A spreadsheet is a natural place to keep many short texts: product names, vocabulary, announcements, lines for a game or a course. Google Sheets cannot voice them by itself, but Apps Script, the scripting built into every Google spreadsheet, can call a text to speech API and save the audio to Google Drive.

This guide shows how to do that with the SuperClonica speech API: one short script that voices the selected row, saves an MP3 and writes its link next to the text.

What you need

A Google account and a SuperClonica API key. Sign in to SuperClonica with Google or GitHub and create the key in the Speech API section of your workspace; the free plan gives a minute of audio a day, enough to test a few rows.

  • Column A holds the texts, column B receives the links to the audio files.
  • In the sheet open Extensions → Apps Script.
  • In Project settings → Script properties add SUPERCLONICA_KEY with your key, so the key never sits in the code.

The script

Paste this function into the Apps Script editor and save. It reads the text of the selected row, sends it to the API, stores the MP3 in your Drive and puts the file link in column B:

function voiceRow() { const sheet = SpreadsheetApp.getActiveSheet(); const row = sheet.getActiveCell().getRow(); const text = sheet.getRange(row, 1).getValue(); const key = PropertiesService.getScriptProperties().getProperty("SUPERCLONICA_KEY"); const answer = UrlFetchApp.fetch("https://superclonica.com/api/v1/speech", { method: "post", contentType: "application/json", headers: { Authorization: "Bearer " + key, "Idempotency-Key": "row-" + row }, payload: JSON.stringify({ text: text, voice: "F1", language: "en", format: "mp3" }), muteHttpExceptions: true }); if (answer.getResponseCode() !== 200) throw new Error(answer.getContentText()); const file = DriveApp.createFile(answer.getBlob().setName("row-" + row + ".mp3")); sheet.getRange(row, 2).setValue(file.getUrl()); }

Run it once from the editor to grant access to the sheet, Drive and external requests; after that, select a row and run voiceRow. The Idempotency-Key makes a repeated run for the same row wait for the same audio instead of voicing it twice.

Many rows at once

To voice a whole column, loop over the rows and skip those that already have a link. Keep in mind that an Apps Script run has a time limit, so voice a few dozen rows per run and start it again for the rest. If the API answers 429, your plan’s 10-minute window is used up: the answer’s Retry-After header says in how many seconds to continue. Pick the voice in the SuperClonica catalog: on a paid plan any catalog voice works by its ID, shown on the voice’s page under “Through the API”.

Costs and privacy

The free plan gives a minute of audio a day; the $5 Starter plan gives 3 minutes every 10 minutes, up to 216 hours a month used without a break. Through the API the text goes to SuperClonica servers and the audio to your Google Drive. For texts that must stay on your computer, run the free SuperClonica engine locally instead.