I have a google spreadsheet that stores data at my work and is constantly being updated via google drive so it is always online editing, what I want to do is to be able to extract the values in those cells and have them show up in a HTML5 table on my website, what would be the best solution for this?
I did try one way which was to just embed the spreadsheet in a iFrame and have that refresh every 5 minutes, but the refresh loading is too slow and it causes issues with trying to get the spreadsheet to fit perfectly in the iframe everytime I refresh. these websites will be on display on TV screens so I dont want to be adjusting them regularly, they will auto refresh and be idle.
I have a google spreadsheet that stores data at my work and is constantly being updated via google drive so it is always online editing, what I want to do is to be able to extract the values in those cells and have them show up in a HTML5 table on my website, what would be the best solution for this?
I did try one way which was to just embed the spreadsheet in a iFrame and have that refresh every 5 minutes, but the refresh loading is too slow and it causes issues with trying to get the spreadsheet to fit perfectly in the iframe everytime I refresh. these websites will be on display on TV screens so I dont want to be adjusting them regularly, they will auto refresh and be idle.
Share Improve this question edited Jan 9, 2015 at 17:46 Dan McGrath 42.1k11 gold badges103 silver badges130 bronze badges asked Jan 4, 2015 at 9:52 thechrishaddadthechrishaddad 6,7458 gold badges29 silver badges34 bronze badges 1- 1 You can try and fetch the info from the sheet as json: developers.google./gdata/samples/spreadsheet_sample once you get it - it will be easy to embed it in your website. – Ido Green Commented Jan 6, 2015 at 10:12
1 Answer
Reset to default 3Your Google Sheet's rows/columns can be exported as a pretty minimal HTML table. You can grab that HTML and manipulate it however you like. Here's how to get it:
Open the Sheet and find your file_id in the URL, and the gid for the specific tab you wish to export (you may have several spreadsheets within a single Google Sheet).
Use this URL string, replacing
<FILE_ID>
and<TAB_GID>
with your own:https://docs.google./spreadsheets/d/<FILE_ID>/gviz/tq?tqx=out:html&tq&gid=<TAB_GID>
You can set the refresh/recalculation rate under File > Spreadsheet settings to be every minute, if necessary.
Example:
Here is a Google Sheet with some data. To export this as an HTML table, we take:
- the file_id:
1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
and - the tab_gid:
0
from the URL and substitute those into the URL string (above), yielding:
https://docs.google./spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/gviz/tq?tqx=out:html&tq&gid=0
Hope that helps.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745112618a4611935.html
评论列表(0条)