最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - How to pull data from google spreadsheet to a website? - Stack Overflow

matteradmin1PV0评论

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?

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?

Share Improve this question asked Aug 28, 2015 at 14:25 Andrew AndersonAndrew Anderson 1,1463 gold badges18 silver badges27 bronze badges 1
  • There has came an answer which suits me best: to insert it through iframe. jsfiddle/Usermane/6v4xp46u But how to make it look better: put it in the center of some area of the webpage, change font, change cell background color etc. I don't want to make any scripts: PHP, Python etc. – Andrew Anderson Commented Aug 31, 2015 at 10:54
Add a ment  | 

3 Answers 3

Reset to default 2

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

<script type="text/javascript">
  window.onload = function() { init() };

  var public_spreadsheet_url = 'https://docs.google./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>

Export the content to excel and import it into a SQL database.

You could do it with any language. PHP for example.

If you are working in Python, there is a library called Copytext that allows you to turn a spreadsheet into a native python object. You'd first have to fetch the spreadsheet, pass it to copytext, extract data of interest, then finally render it to your web page.

But this question has also been addressed here.

Post a comment

comment list (0)

  1. No comments so far