I have a gauge chart in my spreadsheet. I am looking for a line for accessing it.

function myFunction() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("Gauge");
  var charts = sheet.getCharts();
  var crt = charts[0];


The problem is that sheet.getCharts() does not seem to encompass gauge charts. I have tested that by inserting a line chart into the same sheet. return(charts.length); then returned 1.

gauge chart and line chart

How to access the gauge chart?

1 Answer 1


This is a known issue with Google Spreadsheets, first reported a year ago. You can star the issue in the hope of increasing its importance. So far, the response from Google is

Thank you for your report. We have been able to reproduce the problem and have filed it internally.

Since getCharts is the only Sheet method returning embedded charts, Apps Scripts cannot access the charts that getCharts does not support. Gauge is not the only type that lacks such support: same issue exists with some other types listed under "Other", e.g., Polar and Sparkline types.

My impression is that Google shifted resources toward Google Charts API, which is not tied to Spreadsheets. It does support Gauge charts as well as many other types. If you require programmatic access to gauge charts and are okay with them not being in a spreadsheet, this may be your best bet. A standalone script can still get data from a published spreadsheet, but of course this process will involve a bit more coding than with a spreadsheet-bound script.

Related: Embedding a Google Visualization Chart inside a Google Spreadsheet

  • A brilliant answer! Thanks for all the references, I did star the issue, although I don't feel they would fix it soon, especially when Google Code is going off. Very thanks for your insights on how I could go around my problem, I'll try to explore them in more detail.
    – ZygD
    Jun 20, 2015 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.