title: Getting "Requested entity was not found" when fetching Google Sheets data Using REST API v4
body: <p>So, I am trying to fetch data from my Google Sheets using REST API v4. The URL for the spreadsheet is  </p>
  
  <pre><code>https://docs.google.com/spreadsheets/d/1OaknELJVzHxsz5UkH4asuC_xIjgVF3s7JldrxiVuRc/edit#gid=2107620388
  </code></pre>
  
  <p>So, my <code>spreadsheetId</code> is <code>1OaknELJVzHxsz5UkH4asuC_xIjgVF3s7JldrxiVuRc</code>.
  I am following <a href="https://developers.google.com/sheets/api/samples/reading" rel="nofollow noreferrer">this</a> link to fetch the data. The <code>API</code> to use, as per the document is </p>
  
  <pre><code>GET https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!A1:D5
  </code></pre>
  
  <p>Now, for the <code>sheet</code>, I have 2 sheets - <code>transactions</code> and <code>categories</code>.
  <a href="https://i.stack.imgur.com/xGTY6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xGTY6.png" alt="enter image description here"></a></p>
  
  <p>So, my final <code>URL</code> to use became</p>
  
  <pre><code>https://sheets.googleapis.com/v4/spreadsheets/1OaknELJVzHxsz5UkH4asuEC_xIjgVF3s7JldrxiVuRc/values/transactions
  </code></pre>
  
  <p>I used the following <code>curl</code> call to fetch the data</p>
  
  <pre><code>curl -v \
  -H 'Authorization: Bearer ya29.GlxSB5uTisAfJ3umjYbGGdHBWeeuoBpQtytjdHc2QfP2lwVWqsQ7RwT-Or0z7VRAVQzilVWkweZ2WcH3TQqVnmoCZDe3rTn3euZ4MsoV1mCUpNh2bV-KHEhD16Q' \
  -H 'Content-Type: application/json' \
  https://sheets.googleapis.com/v4/spreadsheets/1OaknELJVzHxsz5UkH4asuEC_xIjgVF3s7JldrxiVuRc/values/transactions
  </code></pre>
  
  <p>But, I get the error as below</p>
  
  <pre><code>*   Trying 2607:f8b0:400a:804::200a...
  * TCP_NODELAY set
  * Connected to sheets.googleapis.com (2607:f8b0:400a:804::200a) port 443 (#0)
  * ALPN, offering h2
  * ALPN, offering http/1.1
  * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  * successfully set certificate verify locations:
  *   CAfile: /etc/ssl/cert.pem
    CApath: none
  * TLSv1.2 (OUT), TLS handshake, Client hello (1):
  * TLSv1.2 (IN), TLS handshake, Server hello (2):
  * TLSv1.2 (IN), TLS handshake, Certificate (11):
  * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  * TLSv1.2 (IN), TLS handshake, Server finished (14):
  * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  * TLSv1.2 (OUT), TLS handshake, Finished (20):
  * TLSv1.2 (IN), TLS change cipher, Client hello (1):
  * TLSv1.2 (IN), TLS handshake, Finished (20):
  * SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
  * ALPN, server accepted to use h2
  * Server certificate:
  *  subject: C=US; ST=California; L=Mountain View; O=Google LLC; CN=*.googleapis.com
  *  start date: Jul  2 19:21:00 2019 GMT
  *  expire date: Sep 24 18:57:00 2019 GMT
  *  subjectAltName: host "sheets.googleapis.com" matched cert's "*.googleapis.com"
  *  issuer: C=US; O=Google Trust Services; CN=Google Internet Authority G3
  *  SSL certificate verify ok.
  * Using HTTP2, server supports multi-use
  * Connection state changed (HTTP/2 confirmed)
  * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
  * Using Stream ID: 1 (easy handle 0x7fe5d7800000)
  &gt; GET /v4/spreadsheets/1OaknELJVzHxsUkH4asuEC_xIjgVF3s7JldrxiVuRc/values/transactions HTTP/2
  &gt; Host: sheets.googleapis.com
  &gt; User-Agent: curl/7.54.0
  &gt; Accept: */*
  &gt; Authorization: Bearer ya29.GlxSB5uTisAfJ3umjYbGGdHBWeeutytjdHc2QfP2lwVWqsQ7RwT-Or0z7VRAVQzilVWkweZ2WcH3TQqVnmoCZAehDe3rTn3euZ4MsoV1mCUpNh2bV-KHEhD16Q
  &gt; Content-Type: application/json
  &gt;
  * Connection state changed (MAX_CONCURRENT_STREAMS updated)!
  &lt; HTTP/2 404
  &lt; vary: X-Origin
  &lt; vary: Referer
  &lt; vary: Origin,Accept-Encoding
  &lt; content-type: application/json; charset=UTF-8
  &lt; date: Fri, 26 Jul 2019 23:34:05 GMT
  &lt; server: ESF
  &lt; cache-control: private
  &lt; x-xss-protection: 0
  &lt; x-frame-options: SAMEORIGIN
  &lt; alt-svc: quic=":443"; ma=2592000; v="46,43,39"
  &lt; accept-ranges: none
  &lt;
  {
    "error": {
      "code": 404,
      "message": "Requested entity was not found.",
      "status": "NOT_FOUND"
    }
  }
  * Connection #0 to host sheets.googleapis.com left intact
  </code></pre>
  
  <p>I tried other <code>A1 Notation</code>, but none of them worked</p>
  
  <pre><code>transactions!A:B
  transactions!A1:B2
  categories!A:B
  transactions
  categories
  </code></pre>
  
  <p>I know that my <code>Bearer</code> token is valid and in scope because I am able to create a <code>spreadsheet</code>.
  Also, I am using the following scope for my app</p>
  
  <pre><code>https://www.googleapis.com/auth/drive.file
  </code></pre>
  
  <p>What am I doing wrong here?
  Thanks</p>