简体   繁体   English

将数据从数组发布到Google电子表格

[英]Publishing data from an array to a google spread sheet

I am working on a project where I run a web page from a local server using Xampp. 我正在一个项目中,使用Xampp从本地服务器运行网页。 In the web page I have a button which when clicked produces an array of 24 elements. 在网页中,我有一个按钮,单击该按钮会产生24个元素的数组。 I want this array to be written to my online google sheet. 我希望将此数组写入我的在线Google工作表。

My Question: 我的问题:

1)Can I post data from a web page running on a local server like Xampp to an online server like google sheet? 1)我可以将数据从Xampp等本地服务器上运行的网页发布到google sheet等在线服务器上吗?

2)If yes, then is it possible to do it with php and javascript without any jquery? 2)如果是的话,那么有可能用php和javascript而不用任何jquery吗?

3)If it is possible please show me the right path. 3)如果可能,请告诉我正确的道路。

I am new to web development. 我是Web开发的新手。 Please help me. 请帮我。 Thank you in advance for helping. 预先感谢您的帮助。

Yes it is possible to post data from your localhost as long as you have an internet connection. 是的,只要您有互联网连接,就可以从本地主机发布数据。

to do such things I recommend you to read Sheets API Guides 为此,我建议您阅读Sheets API指南

You will also find there a sample code to write data to a spreadsheet on this page 您还将在此页面上找到示例代码以将数据写入电子表格

Still an API key is required for public spreadsheets for other requests you need to use OAuth 2.0 as told here 对于公共电子表格,仍然需要API密钥才能处理您需要使用OAuth 2.0的其他请求(如此处所述)

If the request requires authorization (such as a request for an individual's private data), then the application must provide an OAuth 2.0 token with the request. 如果请求需要授权(例如对个人私人数据的请求),则应用程序必须随请求提供OAuth 2.0令牌。 The application may also provide the API key, but it doesn't have to. 该应用程序还可以提供API密钥,但不是必须的。

If the request doesn't require authorization (such as a request for public data), then the application must provide either the API key or an OAuth 2.0 token, or both—whatever option is most convenient for you. 如果该请求不需要授权(例如对公共数据的请求),则该应用程序必须提供API密钥或OAuth 2.0令牌,或同时提供二者-无论哪种选择对您来说都是最方便的。

also as an advice and if you know javascript you could use Google App Script to get Started, after validating the implementation of the library into your project and console you will find built-in functions. 同样作为建议,如果您知道javascript,则可以使用Google App脚本入门,在将库的实现验证到您的项目和控制台后,您会发现内置函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM