CSV下载链接API是否稳定(或官方)?

时间:2015-09-16 20:30:14

标签: google-sheets google-spreadsheet-api

这是稳定api的一部分吗?我可以在应用中使用它来使用数据吗?

https://docs.google.com/spreadsheets/d/<KEY>/export?gid=<WORKBOOK_ID>&format=csv

2 个答案:

答案 0 :(得分:4)

AFAIK https://docs.google.com/spreadsheets/d/<KEY>/export?gid=<WORKBOOK_ID>&format=csv不属于当前API。

Google表格API文档链接

https://developers.google.com/google-apps/spreadsheets/

答案 1 :(得分:1)

我认为当时正在运行的解决方案不再可靠。有时他们这样做,有时他们没有。

my_func = function(o,s,a){
    var a = a || [];
    if(o == null){
        return a;
    }
    if(s in o){
        a.push(o[s]);
    }
    for(e in o){
        if(typeof(o[e]) == "object"){
            a.concat(my_func(o[e], s, a))
        }
    }
    return a;
}

(我的测试电子表格包含字符串。)只有第一个请求(pubhtml)仍然有效。也就是说,我的CL输出是#!/bin/bash u='1VaW8fRFJeJ5Wg6-prF8l3xCwbjkx-q_Mqyt8XfjIn6Q' echo "pubhtml" curl -s "https://docs.google.com/spreadsheets/d/$u/pubhtml" | grep -c 'exists to test' echo "export1" curl -s "https://docs.google.com/spreadsheets/d/$u/export?format=csv&id=$u" | grep -c 'exists to test' echo "export2" curl -s "https://docs.google.com/spreadsheets/d/$u/export?format=csv&gid=$u" | grep -c 'exists to test' echo "export3" curl -s "https://docs.google.com/spreadsheets/d/$u/export?format=csv&gid=0" | grep -c 'exists to test' echo "export4" curl -s "https://docs.google.com/spreadsheet/tq?key=$u&gid=1&tq=select%20A,%20B&tqx=reqId:1;out:html;%20responseHandler:webQuery" | grep -c "exists to test" echo "export5" curl -s "https://docs.google.com/spreadsheet/tq?key=$u&id=1&tq=select%20A,%20B&tqx=reqId:1;out:html;%20responseHandler:webQuery" | grep -c "exists to test" exit 0 。所以,如果不使用.net或java,目前的工作选择似乎是pubhtml并重新分析其HTML?

羞耻---这是一种非常简单的方法来下载数据。

/ IAW