Using Google Spreadsheet as JSON file using tabletop to datatables returns error

懵懂的女人 提交于 2019-12-13 01:18:59

问题


I'm a relative newbie when it comes to coding, especially javascript. I currently am trying to populate a table from a google spreadsheet, which will update when the spreadsheet is.

I followed this tutorial word for word (basically all you need to do is replace the key with your own to specify your spreadsheet, and make sure its both published and public, which I've done)

http://dataforradicals.com/the-absurdly-illustrated-guide-to-sortable-searchable-online-data-tables/

I just get a bad request 400 error referring to my spreadsheet. If I visit the spreadsheet generated directly I just get the words...

"Invalid query parameter value for sq."

https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&sq=&callback=Tabletop.callbacks.tt140241226993949106

I can visit my spreadsheet with the link I was given when I published it here..

[maximum links reached but the structure is different]

As you can see the domain structure is different. I fear that "Tabletop to Datatables" is adding an outdated url to the start of that link but can't find where it actually applies it.

The only reason I would think thats not happening is because the example in the tutorial still works! And the link it refers to is the old style URL too

I'm baffled, please help if you can. All suggestions appreciated


回答1:


The query string includes a parameter without a value, &sq=.

https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&sq=&callback=Tabletop.callbacks.tt140241226993949106
                                                                                                                            ^^^^

Try this, with that parameter completely removed...

https://spreadsheets.google.com/feeds/list/1UcfO9GHePQrcixZB_R9uVXr1vHVqVTDg7DdsOjpm-K0/od6/public/values?alt=json-in-script&callback=Tabletop.callbacks.tt140241226993949106




回答2:


There is an updated version of this project. Any necessary updates are included here: https://github.com/scottpham/tabletop-to-datatables

Try with the updated versions of all js libraries.

Check the link and remove the extra string after pub. That part of link is not necessary and may cause issues.

According to google:

The 400 Bad Request error is an HTTP status code that means that the request you sent to the website server, often something simple like a request to load a web page, was somehow incorrect or corrupted and the server couldn't understand it.

Good luck



来源:https://stackoverflow.com/questions/24150667/using-google-spreadsheet-as-json-file-using-tabletop-to-datatables-returns-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!