title: How to update google spreadsheet via sheets API v4
body: <p>I'm facing an issue within updating of existing spreadsheet on google drive, without using a batch update (right now I'm not sure whether it is even possible)</p>
  
  <p>I already have existing spreadsheet with some data, then I retrieve file from google drive via </p>
  
  <pre><code>  Drive drive = new Drive.Builder(TRANSPORT, JSON_FACTORY, credential)
                  .setApplicationName(APPLICATION_NAME)
                  .build();
    drive.files().list().execute().getItems()
  </code></pre>
  
  <p>I easily match my file by the name and then I just want to update the spreadsheet in the founded file.</p>
  
  <pre><code>Sheets service = new Sheets.Builder(GoogleNetHttpTransport.newTrustedTransport(), JSON_FACTORY, credential)
                          .setApplicationName(APPLICATION_NAME)
                          .build();
  Spreadsheet spreadsheet = service.spreadsheets().get(file.getId()).execute().setSheets(new ArrayList&lt;&gt;());
  </code></pre>
  
  <p>Here I get spreadsheet from file which match the name and then I just want to put there empy sheet (for example).</p>
  
  <p>There is first point, where I'm not sure how to correctly "update" the spreadsheet on drive, because I cannot use </p>
  
  <pre><code>service.spreadsheets().create(spreadsheet).execute();
  </code></pre>
  
  <p>and I don't want to use batch update, because I already have set the spreadsheet content via setSheet() method.</p>
  
  <p>I think it should be finalized with following:</p>
  
  <pre><code>Permission permission = drive.permissions().get(file.getId(), permissionId).execute().setType("anyone");
  drive.permissions().update(
      spreadsheet.getSpreadsheetId(),
      permissionId,
      permission
  ).execute();
  </code></pre>
  
  <p>I was checking the google API here:
  <a href="https://developers.google.com/drive/v2/reference/permissions/update" rel="nofollow noreferrer">https://developers.google.com/drive/v2/reference/permissions/update</a>
  and here:
  <a href="https://developers.google.com/sheets/api/guides/batchupdate" rel="nofollow noreferrer">https://developers.google.com/sheets/api/guides/batchupdate</a>
  but they are using batch update.</p>
  
  <p>What I am curious is why there is setSheets() method, which seems to be easily to use for updates, when I already created my sheets, but it seems that I just cannot simply update spreadsheet in existing file. </p>
  
  <p>What is also interesting that every time I use the drive.perm.update, it creates a new file(with spreadsheet that I wanted to update) which actually doesn't make much sense to me.</p>
  
  <p>So is there any chance to simply update file on drive and just use the spreadsheet method?</p>