Jump to content

Export Formulas and Notes from a Google Spreadsheet


Recommended Posts

Dan Thareja has written a Google Script that will let you export all the formulas, cell values and notes from a Google Spreadsheet as a JSON file. You can also pull the Google formulas in another web app or Google Apps script using a GET Request. It should come handy when you are reviewing the formulas of a large sheet.

// Credit: github.com/danthareja

function doGet(request) {
  // ID of Google Spreadsheet
  var json = getNotesAndFormulas(request.parameter.id);

  return ContentService.createTextOutput(JSON.stringify(cache)).setMimeType(ContentService.MimeType.JSON);
}

function getNotesAndFormulas(spreadsheetId) {
  return SpreadsheetApp.openById(spreadsheetId)
    .getSheets()
    .reduce(
      function (cache, sheet) {
        var sheetData = (cache[sheet.getName()] = {});
        var range = sheet.getDataRange();

        sheetData.range = range.getA1Notation();
        sheetData.notes = range.getNotes();
        sheetData.formulas = range.getFormulas();

        return cache;
      },
      { spreadsheetId: spreadsheetId }
    );
}

View the full article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. to insert a cookie message