I've been researching javascript, jquery, xml, google scripts, and the google spreadsheet api, with little luck. I'm trying to create a website that uses a google spreadsheet as a database. It needs to run on a chrome book.
我一直在研究javascript,jquery,xml,google脚本和谷歌电子表格api,运气不佳。我正在尝试创建一个使用Google电子表格作为数据库的网站。它需要在镀铬书上运行。
Hosting sites on google drive doesn't seem to allow jquery. So I can only use html, css, and javascript, that I know of. I usually create asp.net sites with a C# backend, but I can't seem to figure out how to even get data from a published google spreadsheet to display on a google drive hosted website.
谷歌驱动器上的托管网站似乎不允许jquery。所以我只能使用我知道的html,css和javascript。我通常使用C#后端创建asp.net网站,但我似乎无法弄清楚如何从已发布的谷歌电子表格中获取数据以显示在谷歌驱动器托管网站上。
Do any of you have a path that you would suggest? I'm all for researching myself but I need a good starting point which I have yet to find. Thanks
你们中的任何人都有自己建议的道路吗?我全都在研究自己,但我需要一个好的起点,我还没有找到。谢谢
1 个解决方案
#1
1
There is a GitHub library for PHP, if your site happens to use PHP
如果你的网站碰巧使用PHP,那么PHP就有一个GitHub库
github.com php-google-spreadsheet-client
There are a few options:
有几个选择:
- Google Sites - With a Google Stand Alone HTML Apps Script in a Apps Script Gadget
- Google Stand Alone HTML Apps Script
- Website that Uses the Sheets API
Google协作平台 - 在Apps脚本小工具中使用Google独立HTML应用脚本
Google Stand Alone HTML Apps脚本
使用Sheets API的网站
If you try to access a Google sheet from a website with a different domain name, you will get a CORS error. CORS is a Cross Origin Resource Sharing. Each option for connecting to a spreadsheet has it's own issues. If you use a Stand Alone HTML App with Apps Script, you can't have a domain name. A free Google Site, doesn't have a domain name, but it's a nicer URL, and a Google Site can be mapped to a domain name. A website with a regular domain name, will require an API to do something with Sheets. The documentation for the Sheets API show examples written in Protocol, Java, and .Net. But, the documentation states:
如果您尝试从具有不同域名的网站访问Google表格,则会收到CORS错误。 CORS是跨源资源共享。连接到电子表格的每个选项都有自己的问题。如果您使用独立HTML应用程序与Apps脚本,您不能拥有域名。免费的Google网站没有域名,但它是一个更好的网址,Google网站可以映射到域名。具有常规域名的网站将需要API来处理表格。 Sheets API的文档显示了用Protocol,Java和.Net编写的示例。但是,文档说明:
A number of client libraries are provided in various languages. These client libraries make it easier to interact with the Sheets API.
许多客户端库以各种语言提供。这些客户端库可以更轻松地与Sheets API进行交互。
But I don't see any reference to where all these various languages are.
但我没有看到任何关于所有这些语言的参考。
I don't know of any easy to understand documentation for using a Google spreadsheet as a data source from a website. So, unfortunately, I don't know of an easy answer. The answer depends on what you want/need, and how much time and skill you have to set it up.
我不知道使用Google电子表格作为网站数据源的任何易于理解的文档。所以,不幸的是,我不知道一个简单的答案。答案取决于您想要/需要什么,以及您需要多少时间和技巧进行设置。
So, do you need a domain name or not? You can map a Google Site to a domain name:
那么,您是否需要域名?您可以将Google网站映射到域名:
https://support.google.com/sites/answer/99448?hl=en
But the documentation also states:
但文档还说明:
You can't map your domain to what is known as a naked domain, such as http://example.com
您无法将域映射到称为裸域的域,例如http://example.com
If you need to use a website and connect to the Google spreadsheet with an API, you'll need to run an authorization. Otherwise, any website could read/write to your spreadsheet.
如果您需要使用网站并使用API连接到Google电子表格,则需要运行授权。否则,任何网站都可以读/写您的电子表格。
Obviously there are websites that write data to Google spreadsheets, so it's possible.
显然有些网站会将数据写入Google电子表格,所以这是可能的。
You can also look at posts like this:
您还可以查看以下帖子:
#1
1
There is a GitHub library for PHP, if your site happens to use PHP
如果你的网站碰巧使用PHP,那么PHP就有一个GitHub库
github.com php-google-spreadsheet-client
There are a few options:
有几个选择:
- Google Sites - With a Google Stand Alone HTML Apps Script in a Apps Script Gadget
- Google Stand Alone HTML Apps Script
- Website that Uses the Sheets API
Google协作平台 - 在Apps脚本小工具中使用Google独立HTML应用脚本
Google Stand Alone HTML Apps脚本
使用Sheets API的网站
If you try to access a Google sheet from a website with a different domain name, you will get a CORS error. CORS is a Cross Origin Resource Sharing. Each option for connecting to a spreadsheet has it's own issues. If you use a Stand Alone HTML App with Apps Script, you can't have a domain name. A free Google Site, doesn't have a domain name, but it's a nicer URL, and a Google Site can be mapped to a domain name. A website with a regular domain name, will require an API to do something with Sheets. The documentation for the Sheets API show examples written in Protocol, Java, and .Net. But, the documentation states:
如果您尝试从具有不同域名的网站访问Google表格,则会收到CORS错误。 CORS是跨源资源共享。连接到电子表格的每个选项都有自己的问题。如果您使用独立HTML应用程序与Apps脚本,您不能拥有域名。免费的Google网站没有域名,但它是一个更好的网址,Google网站可以映射到域名。具有常规域名的网站将需要API来处理表格。 Sheets API的文档显示了用Protocol,Java和.Net编写的示例。但是,文档说明:
A number of client libraries are provided in various languages. These client libraries make it easier to interact with the Sheets API.
许多客户端库以各种语言提供。这些客户端库可以更轻松地与Sheets API进行交互。
But I don't see any reference to where all these various languages are.
但我没有看到任何关于所有这些语言的参考。
I don't know of any easy to understand documentation for using a Google spreadsheet as a data source from a website. So, unfortunately, I don't know of an easy answer. The answer depends on what you want/need, and how much time and skill you have to set it up.
我不知道使用Google电子表格作为网站数据源的任何易于理解的文档。所以,不幸的是,我不知道一个简单的答案。答案取决于您想要/需要什么,以及您需要多少时间和技巧进行设置。
So, do you need a domain name or not? You can map a Google Site to a domain name:
那么,您是否需要域名?您可以将Google网站映射到域名:
https://support.google.com/sites/answer/99448?hl=en
But the documentation also states:
但文档还说明:
You can't map your domain to what is known as a naked domain, such as http://example.com
您无法将域映射到称为裸域的域,例如http://example.com
If you need to use a website and connect to the Google spreadsheet with an API, you'll need to run an authorization. Otherwise, any website could read/write to your spreadsheet.
如果您需要使用网站并使用API连接到Google电子表格,则需要运行授权。否则,任何网站都可以读/写您的电子表格。
Obviously there are websites that write data to Google spreadsheets, so it's possible.
显然有些网站会将数据写入Google电子表格,所以这是可能的。
You can also look at posts like this:
您还可以查看以下帖子: