3

The Sheetsee library uses google spreadsheets as a data backend. I'm trying to publish my google spreadsheet as json so that I can access it using the Sheetsee library. The current 'Publish to the web' function available in google docs doesn't show any option to publish the data as json. Is this something that has been removed from Google Spreadsheets or is it available somewhere else in google docs?

paweloque
  • 18,466
  • 26
  • 80
  • 136
  • 1
    Possible duplicate of [Accessing a (new-style, public) Google sheet as JSON](https://stackoverflow.com/questions/30082277/accessing-a-new-style-public-google-sheet-as-json) – IMSoP Oct 30 '17 at 14:38

1 Answers1

5

First, you must publish your spreadsheet to the web, using File -> Publish To Web in your Google Spreadsheet.

You can then access your readable JSON API using the /api endpoint.

http://gsx2json.com/api?id=SPREADSHEET_ID&sheet=SHEET_NUMBER&q=QUERY

This will update live with changes to the spreadsheet.

Parameters :

id (required): The ID of your document. This is the big long aplha-numeric code in the middle of your document URL.

sheet (optional): The number of the individual sheet you want to get data from. Your first sheet is 1, your second sheet is 2, etc. If no sheet is entered then 1 is the default. Example

q (optional): A simple query string. This is case insensitive and will add any row containing the string in any cell to the filtered result. Example

integers (optional - default: true): Setting 'integers' to false will return numbers as a string (useful for decimal points). Example

rows (optional - default: true): Setting 'rows' to false will return only column data. Example

columns (optional - default: true): Setting 'columns' to false will return only row data.

Example Response:- There are two sections to the returned data - Columns (containing each column as a data array), and Rows (containing each row of data as an object.

{
    columns: {
        name: [
            "Nick",
            "Chris",
            "Barry"
        ],
        age: [
            21,
            27,
            67;
        ]
    },
    rows: [
        {
            name: "Nick",
            age: 21
        },
        {
            name: "Chris",
            age: 27
        },
        {
            name: "Barry",
            age: 67
        }
    ]
}

src="http://gsx2json.com/"

Sandip Kumar
  • 241
  • 3
  • 25