Save your Google Voicemail to Google Drive as MP3 Files

Published in: Gmail - Google Drive

When you receive a voicemail message on a phone number connected to your Google Voice account, the text transcription of the voice mail is emailed to your Gmail account along with a link to play the audio message on your phone or desktop. Now you can automatically save that voice mail to your Google Drive as an MP3 file.

Google Voicemail as MP3

I have written a little web app that scans your Gmail mailbox for any voicemails from Google Voice and it will save the audio in a specific folder on your Google Drive. The app attaches the voicemail transcript to the MP3 file as well thus making it possible for you to search your voice mails from within Google Drive.

To get started, click here and authorize why the app to access your Gmail and Google Drive accounts. On the next screen, click the Google Voice button and wait for the app to initialize. That’s it. The app will run in the background and monitor your Gmail account for any messages from Google Voicemail.

It creates a new folder called Google Voice in your Google Drive and all the voicemail MP3 files are saved in this folder. Also, once a voice mail has been processed in Gmail, a new label called MP3 is applied to that message to prevent the app from reprocessing that email message.

The app is powered by Google Scripts and the entire source code is available below. You can stop the script anytime using the uninstallation link that would have arrived in your Gmail account when you authorized the app.

Google Script - Save Voice Mail as MP3 in Google Drive

/* Written by Amit Agarwal   */
/* Tutorial:  */

var folder,  folder_name = "Google Voice";
var archive, gmail_label  = "MP3";

/* Find Google Voice messages in Gmail */

var filter  = " -label:" + gmail_label;
var threads =, 0, 10);

if (threads.length) {

  /* Google Drive folder where the MP3 files will get stored */
  var folders = DriveApp.getFoldersByName(folder_name);
  folder = folders.hasNext() ? : DriveApp.createFolder(folder_name);

  /* Gmail Label that is applied to processed voice mails */
  archive = GmailApp.getUserLabelByName(gmail_label) ?
    GmailApp.getUserLabelByName(gmail_label) : GmailApp.createLabel(gmail_label);

  for (var x=0; x<threads.length; x++) {


    var msg = threads[x].getMessages()[0];

    /* Find the link to play the voice mail message */
    var url = msg.getBody().match(/https?:\/\/\/voice\/fm[^\"]*/gi);

    if (url) {

      /* Find the name of the voice sender (or their phone number) */
      var file_name = msg.getSubject().match(/new voicemail from (.*) at /i);

      /* Add the voice mail date to the file name */
      var file_date = Utilities.formatDate(
        msg.getDate(), Session.getScriptTimeZone(), "yyyy-MM-dd HH:mm");

      if (file_name) {

        /* Extract the audio file and save as an MP3 file */
        var mp3 = url[0].replace("/voice/fm/", "/voice/media/svm/");
        var file = folder.createFile(UrlFetchApp.fetch(mp3).getBlob());

        /* Save the voice mail transcript with the audio file */
        file.setName(file_name[1] + " [" + file_date + "]" + ".mp3");


PS:The script triggers every 15 minutes and processes 10 voice mail messages in the batch starting with the most recent ones. If you have too many old voice mails in your Gmail account, it may take a while to process all the emails.

[**] The web app requires permissions to access your Gmail and Google Drive. I have shared the full source code of the app but if you aren’t convinced yet, just make a copy of the above code in your Google Drive and run it manually.

Also see: Save Gmail Attachments to Google Drive

📮  Subscribe to our Email Newsletter for Google tips and tutorials!
Published in: Gmail - Google Drive

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch

Google Add-ons

Do more with your Gmail and GSuite account

We build bespoke solutions that use the capabilities and the features of Google Workspace for automating business processes and driving work productivity.

  1. Mail Merge with Attachments
    Send personalized email to your Google Contact with a Google Sheet and Gmail
  2. Save Emails and Attachments
    Download email messages and file attachments from Gmail to your Google Drive
  3. Google Forms Email Notifications
    Send email notifications to multiple people when a new Google Form is submitted
  4. Document Studio
    Create beautiful pixel perfect documents merging data from Google Sheets and Google Forms
  5. Creator Studio for Google Slides
    Turn your Google Slides presentations into animated GIFs and videos for uploading to YouTube