Is there a Google Sheets RESTful API for reading rows from one sheet?

Here is my google sheet in comma separated format:

ROW, TITLE
1, "Green eggs and ham"
2, "War and peace"
3, "Good Burger: The Movie: The Book"

      

What URL should I enter into my browser to get this data in JSON or XML?

+3


source to share


3 answers


Here is what works for me to get XML

https://spreadsheets.google.com/feeds/list/yourSpreadsheetID/od6/public/values

      

and for JSON:

https://spreadsheets.google.com/feeds/list/yourSpreadsheetID/od6/public/values?alt=json

      

This is from a spreadsheet published online. If the sheet is not published on the web, I get an error:

We regret. This document has not been published.

Here's what I could get for information from the documentation. If any information is incorrect, please leave a comment.

The REST Sheets API documentation is located at the following link:



Google Sheets API

The way that any REST Api works is that an HTTPS GET or POST request must be made. Don't look in the client library for other languages ​​like GO, Java, .NET, etc. if you want to use the REST API.

The only way to get information from a spreadsheet without going through the authorization process is to publish the spreadsheet on the Internet. Therefore, if you are trying to get data from a REST Api spreadsheet that you do not want to publish on the Internet, you need to go through the authorization process.

Quoting from google documentation:

When your app requests non-public user data, it must include an authorization token. The token also identifies your application to Google.

Authorizing requests

The URL entered into the browser address bar is a GET request. Anything that requires a POST request cannot be used in the browser's address bar. Even though a GET request can be made in the address bar of the browser, some HTTP requests still require a corresponding authorization header. Which I don't think you can do in the address bar of your browser.

+4


source


Try Sheetsu . You can create a rest api for it based on the Google Spreadsheet url.



+1


source


I think you are looking for this: https://developers.google.com/sheets/api/reference/rest/#rest-resource-v4spreadsheetsvalues

REST Resource: v4.spreadsheets Methods

batchUpdate     POST /v4/spreadsheets/{spreadsheetId}:batchUpdate Applies one or more updates to the spreadsheet.
create          POST /v4/spreadsheets Creates a spreadsheet, returning the newly created spreadsheet.
get             GET /v4/spreadsheets/{spreadsheetId} Returns the spreadsheet at the given ID.
getByDataFilter     POST /v4/spreadsheets/{spreadsheetId}:getByDataFilter

      

Returns the table with the given ID.

0


source







All Articles