我使用它作为参考https://github.com/ruucm/react-google-sheets 但每当我运行它时我都会收到一个 gapi 404 错误我有预感 github 链接不存在,因此我的应用程序不能工作
或者也许我错了。
是否有一个非常好的参考资料,我可以将数据从 react js 发送到谷歌电子表格?
我已经在电子表格上尝试了很多次尝试,但它在电子表格中将数据提供给应用程序的位置正好相反我需要的是对电子表格做出反应
import React, { Component } from 'react';
import ReactGoogleSheets from 'react-google-sheets';
class GoogleSheets extends Component {
constructor(props) {
super(props)
this.state = {
sheetLoaded: false,
}
}
render() {
return (
<ReactGoogleSheets
clientId={'243...apps.googleusercontent.com'}
apiKey={'AIza...'}
spreadsheetId={'2PAC...'}
afterLoading={() => this.setState({ sheetLoaded: true })}
>
{this.state.sheetLoaded ?
<div>
{/* Access Data */}
{console.log('Your sheet data : ', this.props.getSheetsData( 'gSheets' ))}
{/* Update Data */}
<button onClick={() => {
this.props.updateCell( …Run Code Online (Sandbox Code Playgroud) 需要发生的是,我的 React Web 应用程序中有此表单,输入的数据应发送到 Google 电子表格。
| NAME | NUMBER |
|-------|---------|
|Joe |123 |
|Brian |420 |
|Raine |143 |
Run Code Online (Sandbox Code Playgroud)
我如何从网络应用程序执行此操作?
我已经尝试过,但仍然没有运气
这是来自网络应用程序,其中包含一些代码componentDidMount()
此代码用于表单数据并防止页面重定向到应用程序脚本链接。基本上它保留在页面上,甚至重新加载表单。
componentDidMount() {
console.log("Contact form submission handler loaded successfully.");
// bind to the submit event of our form
var forms = document.querySelectorAll("form.gform");
for (var i = 0; i < forms.length; i++) {
forms[i].addEventListener("submit", handleFormSubmit, false);
}
//document.addEventListener("DOMContentLoaded", loaded, false);
function validateHuman(honeypot) {
if (honeypot) { //if hidden form filled up …Run Code Online (Sandbox Code Playgroud)