带有React Native的Google Sheets API [英] Google Sheets API with React Native

查看:113
本文介绍了带有React Native的Google Sheets API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本机反应新手.尝试对位于Google Drive中的Google电子表格执行简单的操作.我已经成功实现了 react-native-google-signin react-native-google-drive-api-包装器,并可以查看我的电子表格.下一步是找到实现Google表格API v4的react-native程序包.我已经尝试过 Iwark的/react-native-spreadsheet 用于react/node.js,但是尝试在本机环境中构建时会产生错误.任何方向将不胜感激.

New to react-native. Trying to do simple crud operations on a google spreadsheet located in google drive. I've successfully implemented the packages for react-native-google-signin and react-native-google-drive-api-wrapper and can see my spreadsheets. Next step is finding a react-native package that implements google sheets API v4. I've tried Iwark's/react-native-spreadsheet for react/node.js but it produces errors when trying to build in a react-native environment. Any direction would be appreciated.

推荐答案

我希望可以使用googleapis and google-auth-library两个库来做到这一点; 然后通过初始化apis

I am hoping can do this using googleapis and google-auth-library two libraries; Then initialise the apis by doing

var authClient = new googleAuth();
  var auth = new authClient.OAuth2();
  auth.credentials = {
    access_token: accessToken
  };
  this.service = google.sheets({version: 'v4', auth: auth});

然后使用this.service

Then use the this.service

如果这没有太大意义,请等待几个小时或明天,我们将为您提供工作副本. :)

If this doesn't make much sense, wait for few hours or tomorrow, I will help you with a working copy. :)

我认为这是您应该做的,"

This is what I think you should do,"

  1. 如果您公开电子表格,请遵循 a)您需要进行用户登录(使用firebase google登录),然后获取access_token并在https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}中使用access_token进行获取或发布请求等.

    a) You need to make the user login (use firebase google login), then get the access_token and do a get with access_token in https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId} or post request etc.

    b)在处理所有这些问题的节点服务器中发出发布请求

    b) Make a post request in your node server where you handle all of these

    注意:这个周末我可能会为您提供一个可行的示例.

    Note: I might help you with a working example this weekend.

    这篇关于带有React Native的Google Sheets API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆