简体   繁体   English

将Google电子表格发布为JSON

[英]Publish a google spreadsheet as json

The Sheetsee library uses google spreadsheets as a data backend. Sheetsee库使用google电子表格作为数据后端。 I'm trying to publish my google spreadsheet as json so that I can access it using the Sheetsee library. 我正在尝试将我的Google电子表格发布为json,以便可以使用Sheetsee库进行访问。 The current 'Publish to the web' function available in google docs doesn't show any option to publish the data as json. google docs中可用的当前“发布到网络”功能未显示任何将数据发布为json的选项。 Is this something that has been removed from Google Spreadsheets or is it available somewhere else in google docs? 这是已从Google Spreadsheets中删除的东西,还是在Google文档中的其他地方可用?

First, you must publish your spreadsheet to the web, using File -> Publish To Web in your Google Spreadsheet. 首先,必须使用Google Spreadsheet中的File -> Publish To Web将电子表格File -> Publish To Web上。

You can then access your readable JSON API using the /api endpoint. 然后,您可以使用/ api端点访问可读的JSON API。

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. id(必填):您的文档ID。 This is the big long aplha-numeric code in the middle of your document URL. 这是文档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. 您的第一张纸是1,第二张纸是2,依此类推。如果未输入任何纸,则默认为1。 Example

q (optional): A simple query string. q(可选):一个简单的查询字符串。 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). 整数(可选-默认值:true):将'integers'设置为false会以字符串形式返回数字(用于小数点)。 Example

rows (optional - default: true): Setting 'rows' to false will return only column data. 行(可选-默认:true):将'rows'设置为false将仅返回列数据。 Example

columns (optional - default: true): Setting 'columns' to false will return only row data. 列(可选-默认:true):将'columns'设置为false将仅返回行数据。

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/ " src =“ http://gsx2json.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM