如何将数据从谷歌电子表格拉到网站?

时间:2015-08-28 14:25:53

标签: javascript jquery html web google-sheets

有一个公开分享的google spreadsheet with price data

有一种查询语言,我们可以从中提取特定数据,例如将此query放入浏览器地址字段。 通过这种方式我们得到第一项的价格。

哪些可能没有大惊小怪的方法将它插入明确网页的明确位置?

只有javascript / jquery可以使这个工作吗?

3 个答案:

答案 0 :(得分:1)

将内容导出到excel并将其导入SQL数据库。

你可以用任何语言来做。以PHP为例。

答案 1 :(得分: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 :(得分:0)

如果您使用的是Python,则会有一个名为Copytext的库,它允许您将电子表格转换为本机python对象。您首先必须获取电子表格,将其传递给copytext,提取感兴趣的数据,然后最终将其呈现到您的网页。

但是这个问题也得到了解决here

相关问题