Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pull data from google spreadsheet to a website?

There is a publicly shared google spreadsheet with price data.

There is a query language and we can pull specific data from it, e.g. putting this query into browser address field. In such a way we get the price of the first item.

Which are the possible no big fuss ways to insert it in the definite place of definite webpages?

Is it true that only javascript/jquery can make this work?

like image 384
Andrew Anderson Avatar asked Mar 25 '26 03:03

Andrew Anderson


1 Answers

Using Tabletop library https://github.com/jsoma/tabletop you can do:

<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>
like image 82
Juancho Ramone Avatar answered Mar 26 '26 15:03

Juancho Ramone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!