google-sheetsgoogle-apps-scriptexceptioncharts

Google Spreadsheets: updateChart fail exception


I have a couple of Google Spreadsheet files that contains a charts.
I need to set a minimum and maximum value at vertical axes of that charts which are taken from some indicated fields.
From the last about 2 years I did it by the script like this:

  var sh=s.getSheetByName("expenses");
  var chart = sh.getCharts()[0];
  var kMin=sh.getRange(57, 4).getValue(); //field with minimum value
  var kMax=sh.getRange(58, 4).getValue(); //field with maximum value
  chart = chart.modify()
    .setOption('vAxes.0.viewWindow.min', kMin)
    .setOption('vAxes.0.viewWindow.max', kMax)
    .build();
  sh.updateChart(chart);

Unfortunately since about middle of February at EACH of my files every attempt of the script's executing ends at line:

  sh.updateChart(chart);

with the error:

Exception: Service Spreadsheets failed while accessing document with id ...

which is very strange because all the files has a very small size and that error has started to appear on each files (which are completely separated from others) in the same day.


Solution

  • This is a reported bug

    It seems there are two (edit: three) that show similar behavior:

    https://issuetracker.google.com/183028007

    https://issuetracker.google.com/183515551

    https://issuetracker.google.com/158310285

    If this affects you go and ☆ the issue to let Google know that it affects you.

    Since this is probably a bug that is difficult to reproduce, if you are able to find a way to reproduce the behavior starting with a new project from scratch, definitely post it in the issue!