title: Google Sheets API V4 PHP - inserting data 400 error
body: <p>First time using Google API, bit confused at the documentation, wonder if someone could help me.</p>
  
  <p>I am getting this error:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'Google_Service_Exception' with message '{
        "error": {<br>
            "code": 400,<br>
            "message": "Invalid value at 'data.values' (type.googleapis.com/google.protobuf.ListValue), \"[{\"Name\":\"a\"}]\"",<br>
                "errors": [<br>
                    {<br>
                    "message": "Invalid value at 'data.values' (type.googleapis.com/google.protobuf.ListValue), \"[{\"Name\":\"a\"}]\"",<br>
                    "domain": "global",<br>
                    "reason": "badRequest"<br>
                    }<br>
                ],<br>
            "status": "INVALID_ARGUMENT"<br>
            }<br>
        }<br></p>
  </blockquote>
  
  <p>Checked with the Google API Docs, which says, do this:</p>
  
  <pre><code>$values = array(
      array(
         // Cell values ...
      ),
      // Additional rows ...
  );
  $body = new Google_Service_Sheets_ValueRange(array(
      'values' =&gt; $values
  ));
  $params = array(
      'valueInputOption' =&gt; $valueInputOption
      );
  $result = $service-&gt;spreadsheets_values-&gt;update($spreadsheetId, $range, $body, $params);
  </code></pre>
  
  <p>I've tried to enter different values in that $value array, but no matter what I try I just get Invalid Value at data.values.</p>