title: Getting 403 Error while appending logs in Google sheet (JAVA)
body: <p>I am trying to append Logs from java into the Google Sheet but I am getting <code>403</code> error</p>
  <p>Dummy Code:</p>
  <pre><code>private static void appendCurrentRunLog(String spreadSheetId, Sheets service,String logId)
      {
          try{
              String logSheetRange=logId+&quot;.log!A1:Z&quot;;
              for(int k=0;k&lt;logList.size();k++){
                  ValueRange appendbody = new ValueRange().setValues(
                          Arrays.asList(Arrays.asList(logList.get(k))));
                  service.spreadsheets().values()
                          .append(spreadSheetId, logSheetRange, appendbody)
                          .setValueInputOption(&quot;user_entered&quot;)
                          .setInsertDataOption(&quot;insert_rows&quot;)
                          .setIncludeValuesInResponse(true)
                          .execute();
              }
          }catch (Exception e){
              mLogger.info(&quot;Failed while inserting logs&quot;+e.getMessage());
              e.printStackTrace();
          }
      }
  </code></pre>
  <p>Error:</p>
  <pre><code>com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
  {
    &quot;code&quot; : 403,
    &quot;errors&quot; : [ {
      &quot;domain&quot; : &quot;global&quot;,
      &quot;message&quot; : &quot;Request had insufficient authentication scopes.&quot;,
      &quot;reason&quot; : &quot;forbidden&quot;
    } ],
    &quot;message&quot; : &quot;Request had insufficient authentication scopes.&quot;,
    &quot;status&quot; : &quot;PERMISSION_DENIED&quot;
  }
  </code></pre>
  <p>where should I use batchUpdate() and how?
  Any other solution?
  Please suggest!!</p>