title: Google sheets API permission error for writing with gspread
body: <p>I'm getting an error when trying to update the value of a spreadsheet via an external editor. I'm using the python library 'gspread'; I have read access to the document but when I try to update a cell I get an API error.</p>
  
  <p>Here is the code (security details obscured). I've looked at other permission error solutions on stackoverflow, but they don't apply to the scenario where an app can read data but not write it.</p>
  
  <pre><code>import gspread
  from oauth2client.service_account import ServiceAccountCredentials
  
  scope = [""
        , "https://www.googleapis.com/auth/script.external_request"
        , "https://www.googleapis.com/auth/spreadsheets"
        , "https://www.googleapis.com/auth/script.container.ui"
        ,   'https://spreadsheets.google.com/feeds'
        , "https://mail.google.com/"
        , " https://www.googleapis.com/auth/drive"]
  
  credentials = ServiceAccountCredentials.from_json_keyfile_name('project-id-[hiddenID].json', scope)
  
  gc = gspread.authorize(credentials)
  
  sht2 = gc.open_by_url('https://docs.google.com/spreadsheets/d/[hiddenID]')
  
  worksheet = sht2.get_worksheet(0)
  
  val = worksheet.acell('B1').value
  print(val)
  
  
  
  worksheet.update_acell('B6', 'Bingo!')
  </code></pre>
  
  <p>It's the last line that calls the error</p>
  
  <pre><code>APIError: {
    "error": {
      "code": 403,
      "message": "The caller does not have permission",
      "status": "PERMISSION_DENIED"
    }
  }
  </code></pre>
  
  <p>I've tried giving the API owner access, but I guess I'm doing the permissions wrong.</p>
  
  <p>Thanks for any help!</p>