【问题标题】:How to pull data from google spreadsheet to a website?如何从谷歌电子表格中提取数据到网站?
【发布时间】:2015-08-28 14:25:52
【问题描述】:
【问题讨论】:
标签:
javascript
jquery
html
web
google-sheets
【解决方案1】:
使用桌面库https://github.com/jsoma/tabletop你可以做到:
<script type="text/javascript">
window.onload = function() { init() };
var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AmYzu_s7QHsmdDNZUzRlYldnWTZCLXdrMXlYQzVxSFE&output=html';
function init() {
Tabletop.init( { key: public_spreadsheet_url,
callback: showInfo,
simpleSheet: true } )
}
function showInfo(data, tabletop) {
alert("Successfully processed!")
console.log(data);
}
</script>
【解决方案2】:
将内容导出为 Excel 并将其导入 SQL 数据库。
你可以用任何语言来做。以 PHP 为例。
【解决方案3】:
如果您使用 Python,有一个名为 Copytext 的库可让您将电子表格转换为原生 Python 对象。您首先必须获取电子表格,将其传递给 copytext,提取感兴趣的数据,然后最终将其呈现到您的网页。
但是这个问题也已经解决了here。