0

Is this a part of a stable api? Can I use it in an app to consume the data?

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

4

2 回答 2

4

AFAIK https://docs.google.com/spreadsheets/d/<KEY>/export?gid=<WORKBOOK_ID>&format=csv is not part of a current API.

The Google Sheets API documentation link is

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

于 2015-09-19T00:14:32.437 回答
1

I think the then-working solutions no longer work reliably. sometimes they do, sometimes they do not.

#!/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

(my test spreadsheet contains the string.) only the first request (pubhtml) still works. that is, my CL output is 1 0 0 0 0 0 . so, short of using .net or java, the current working choice seems to be pubhtml and reparsing its HTML?

shame---it was such a useful easy way to pull down data.

/iaw

于 2015-10-27T20:57:46.280 回答