Question

Is there a way to use Javascript to interact with an google spreadsheet when embedded in a html website?

I am looking to do some of the following operations:

  • Switch Worksheets
  • Read the formula (or value) of a cell / active cell
  • Set the value of a cell / active cell
  • Adjust formatting or some of the other features available when using Google Scripts inside the spreadsheet application.

I know google has a great app engine that works inside google docs but I would like to be able to interact with the spreadsheet via javascript when it is embedded inside an iframe.

Was it helpful?

Solution

There are two ways you can do this

  1. Use the JavaScript API for Spreadsheets ( https://developers.google.com/api-client-library/javascript/start/start-js )

  2. Write a Google Apps Script, deploy it as a web app and make AJAX/REST calls from your JavaScript. See Content Service to see how this can be done using GAS ( https://developers.google.com/apps-script/guides/content )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top