Reputation: 159
I am new to React Native. I am trying to do simple CRUD operations on a Google spreadsheet located on 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.
The 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. What can I do?
Upvotes: 2
Views: 6524
Reputation: 3856
I am hoping you can do this using the two libraries googleapis and google-auth-library
.
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});
Then use the this.service.
If this doesn't make much sense, wait for a few hours or tomorrow. I will help you with a working copy. :)
This is what I think you should do,
a) You need to make the user login (use the 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) Make a post request in your Node.js server where you handle all of these
Note: I might help you with a working example this weekend.
Upvotes: 3
Reputation: 2430
Install
npm install tabletop
Import
import Tabletop from 'tabletop';
Use
Tabletop.init({
key: url,
callback: googleData => {
console.log(googleData);
},
simpleSheet: true
})
Publishing your Google Sheet
url = File->Publish to the web. Then click Start publishing
Upvotes: 0