title: Adding hAxis.gridlines to EmbeddedChart
body: <p>I am trying to make a time series plot in Google Sheets using Apps Script. It seems that the object I need is the class <code>EmbeddedChartBuilder</code>. After looking at the examples in the <a href="https://developers.google.com/apps-script/reference/spreadsheet/embedded-chart" rel="nofollow noreferrer">documentation</a>, here is what I wrote:  </p>
  
  <pre class="lang-js prettyprint-override"><code>function getChart(){
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];
    var chart = sheet.newChart()
    .setChartType(Charts.ChartType.LINE)
    .addRange(sheet.getRange("D2:D65"))
    .addRange(sheet.getRange("A2:A65"))
    .addRange(sheet.getRange("B2:B65"))
    .setPosition(5, 5, 0, 0)
    .build();
    sheet.insertChart(chart);
  }
  </code></pre>
  
  <p>By default the plot shows up with <strong>only horizontal gridlines</strong> (i.e. vertical axis gridline):</p>
  
  <p><img src="https://i.stack.imgur.com/FSGOi.png" alt="enter image description here"></p>
  
  <p>but I would like to also have vertical gridlines. It turns out that <code>EmbeddedChartBuilder</code> has a <code>setOptions</code> method, which is documented <a href="https://developers.google.com/apps-script/reference/spreadsheet/embedded-chart-builder#setOption%28String,Object%29" rel="nofollow noreferrer">here</a>. This is the point where I get confused: looking at the <a href="https://developers.google.com/chart/interactive/docs/reference" rel="nofollow noreferrer">Google Visualization API Reference documentation</a>, it seems that the <a href="https://developers.google.com/chart/interactive/docs/gallery/linechart#Configuration_Options" rel="nofollow noreferrer">configuration options</a> for a LineChart include <code>hAxis.gridlines</code>. So I changed my code accordingly:</p>
  
  <pre class="lang-js prettyprint-override"><code>function getChart(){
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];
    var chart = sheet.newChart()
    .setChartType(Charts.ChartType.LINE)
    .addRange(sheet.getRange("D2:D65"))
    .addRange(sheet.getRange("A2:A65"))
    .addRange(sheet.getRange("B2:B65"))
    .setPosition(5, 5, 0, 0)
    .setOption('hAxis.gridlines.count', -1)
    .setOption('hAxis.gridlines.color','#000000')
    .build();
    sheet.insertChart(chart);
  }
  </code></pre>
  
  <p>but the chart didn't change at all, still no sign of vertical gridlines. What am I doing wrong? </p>
  
  <p>Thanks in advance for your help!!</p>