Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/odwyersoftware/sheet2api-js
JavaScript Library for Google Sheets/Microsoft Excel Online through sheet2api. https://sheet2api.com/
https://github.com/odwyersoftware/sheet2api-js
api-client excel google-sheets-api javascript spreadsheets
Last synced: 3 months ago
JSON representation
JavaScript Library for Google Sheets/Microsoft Excel Online through sheet2api. https://sheet2api.com/
- Host: GitHub
- URL: https://github.com/odwyersoftware/sheet2api-js
- Owner: odwyersoftware
- Created: 2020-07-13T21:13:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-10T14:24:08.000Z (almost 2 years ago)
- Last Synced: 2024-04-27T16:34:32.107Z (7 months ago)
- Topics: api-client, excel, google-sheets-api, javascript, spreadsheets
- Language: JavaScript
- Homepage: https://sheet2api.com/
- Size: 145 KB
- Stars: 91
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sheet2api JavaScript Client
JavaScript Library for Google Sheets/Microsoft Excel Online through sheet2api. https://sheet2api.com/
## Installation
The sheet2api JS library can be installed through npm.
```bash
npm install sheet2api-js --save
```## Example Usage
To get started you need to provide your sheet2api Spreadsheet API URL. You can find it on the [sheet2api Dashboard](https://sheet2api.com).
Try it out with the codepen https://codepen.io/sheet2api/pen/MWKZrqW
### Importing the library
```html
```
```js
// Or, Require import
const Sheet2API = require('sheet2api-js');
// Or, ES6 import
import Sheet2API from 'sheet2api-js';
```### Read rows
```html
const url = 'https://sheet2api.com/v1/FgI6zV8qT121/characters/';
const options = {};
Sheet2API.read(url, options).then(function(result){
console.log(result);
}, function(error){
console.log(error);
});```
### Read rows matching a search query
```html
const url = 'https://sheet2api.com/v1/FgI6zV8qT121/characters/';
const options = {query: { 'Name': 'Bugs Bunny' }};
Sheet2API.read(url, options).then(function(result){
console.log(result);
}, function(error){
console.log(error);
});```
### Create new rows
```html
const url = 'https://sheet2api.com/v1/FgI6zV8qT121/characters/';
const newRowData = { "Favourite Thing": "Carrots", "Name": "Bugs Bunny" };
const options = {};
Sheet2API.write(url, options, newRowData).then(function(result){
console.log(result);
}, function(error){
console.log(error);
});```
### Update existing rows matching a search query
```html
const url = 'https://sheet2api.com/v1/FgI6zV8qT121/characters/';
const updateWithData = { "Favourite Thing": "Beer", "Name": "Bugs Bunny" };
const options = {query: { 'Name': 'Bugs Bunny' }};
Sheet2API.update(url, options, updateWithData).then(function(result){
console.log(result);
}, function(error){
console.log(error);
});```
### Update partially, existing rows matching a search query
Note, If you don’t include values for all columns (Name, Favourite Thing, Image) in the request body, then missing column values will not be updated, just the ones which were present in the request body.
```html
const url = 'https://sheet2api.com/v1/FgI6zV8qT121/characters/';
const updateWithData = { "Name": "Bugs" };
const options = {query: { 'Name': 'Bugs Bunny' }};
Sheet2API.updatePartial(url, options, updateWithData).then(function(result){
console.log(result);
}, function(error){
console.log(error);
});```
### Authentication
If you have enabled Basic Authentication on your sheet2api API.
```javascript
const options = {
auth: ['username', 'password']
};
Sheet2API.read(url, options).then(function(result){
console.log(result);
}, function(error){
console.log(error);
});```
Something missing you'd like to see? Please create an issue.