title: Using CURL to edit entries on google sheets documents
body: <p>After some confusion, I did get reading from a public sheet working:</p>
  
  <p><code>curl https://sheets.googleapis.com/v4/spreadsheets/[sheetID]/values/A1?key=[MyAPIKey]</code></p>
  
  <p>Where Sheet ID is from google sheets, and [MyAPIKey] is from <a href="https://developers.google.com/sheets/api/guides/authorizing#APIKey" rel="nofollow noreferrer">https://developers.google.com/sheets/api/guides/authorizing#APIKey</a></p>
  
  <p>It gives me read-access to the sheet.</p>
  
  <p>As soon as I try to write to any cells on the sheet (despite them being publicly writable) it gives me an error.  I can easily edit them anonymously from my browser without any keys, however, I can't seem to edit them at all without API keys.</p>
  
  <p>If I issue:</p>
  
  <pre><code>    curl https://sheets.googleapis.com/v4/spreadsheets/[sheetid]/values/Sheet1\!A1?valueInputOption=RAW?key=[MyAPIKey] -X PUT -d "{\"values\":[ [ \"Test\" ] ] }"
  </code></pre>
  
  <p>I receive:
  <code>{
            "error": {
              "code": 401,
              "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
              "status": "UNAUTHENTICATED"
            }
          }
  </code></p>
  
  <p>I think this is related to <a href="https://stackoverflow.com/questions/40922685/google-sheets-api-v4-append-request-receives-http-401-response-for-public-feeds">Google Sheets API v4 append request receives HTTP 401 response for public feeds using API Key</a></p>
  
  <p>I'm avoiding the OAUTH2 mechanism as for this task, I can't allow applications access to entire google drive.  How can this be done with selective link-based access, like is done via the authkey approach?  Is there some other way to give sheet-at-a-time access in OAUTH2?</p>