sheet2api logo Sign in

Excel Online API JavaScript

How to use the Excel Online API using JavaScript.

How to use the Excel Online API using JavaScript.

There are two ways to do this:

  1. Directly use the Excel Online API. The downside of this being it takes a significant amount of time to learn and setup all the configuration.
  2. Just use sheet2api. This takes care of all that configuration for you, all you need is the URL to your Excel Online spreadsheet to get started.

Easy setup

  1. Install the JavaScript package with npm.
  2. npm install sheet2api-js --save
  3. Run Excel Online API request with JavaScript.
  4. import Sheet2API from 'sheet2api-js';
    
    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);
    });
  5. Create and use your own sheet2api API.

Examples

Here are some ready to use Excel Online API examples using the JavaScript client. Simply copy them into your project and you're good to go.

Read all rows

// Returns all rows from the first Sheet.
import Sheet2API from 'sheet2api-js';

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 which match search terms

// Returns all rows from the first Sheet, filtered by search terms.
import Sheet2API from 'sheet2api-js';

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);
});

Add a new row

// Adds a new row to the Sheet.
import Sheet2API from 'sheet2api-js';

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);
});

For more in-depth examples check out the Github code repository.


It's as easy as that 🎉.

If you need help, please feel free to send a message via the contact page.

Start using sheet2api now

Be up & running in seconds.