RestSheet is a free (for now) service that let's you manipulate Excel files via REST APIs. It is free because we don't keep a copy of any file and it is built using free hosting from webflow.io and gigalixirapp.com.
It is a tool designed for developers where you can upload, write and read an excel files on the fly.
There is only one API endpoint which is https://excel-to-api.gigalixirapp.com/api/changeset
and it accepts the format form-data
(as you can see in the example below) and the Bearer token as a form of authentication.
If you get a 500 double-check the cell numbers and sheet names.
On a very high level this is what happens when you make a call:
- HTTP call
- Payload: upload the file and change X,Y,Z + read X, Y
- The server will store a copy of the file, write it, recalculate all formulas, read it again and return the result
- The file gets deleted from the server
- Your quota gets decreased by 1 (100 free uses per day)
Visit https://excel-to-api.gigalixirapp.com and create an account
On https://excel-to-api.gigalixirapp.com/, navigate to https://excel-to-api.gigalixirapp.com/users/settings and get your personal token.
Download this Excel file (does nothing but the sum of some cells, check it out): https://docs.google.com/spreadsheets/d/1WuVi7F1PDpH69JWRa9bDxTHT1JaA5w43/edit?usp=sharing&ouid=113909502023297765536&rtpof=true&sd=true
Get the path of your downloaded file and replace both the TOKEN and the PATH of your file, then try to run this code:
curl --location --request POST 'https://excel-to-api.gigalixirapp.com/api/changeset' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--form 'changes="[{\"cell\": \"A1\", \"sheet\": \"Sheet 1\", \"value\": 4}]"' \
--form 'select="[{\"cell\": \"A7\", \"sheet\": \"Sheet 1\"}]"' \
--form 'file=@"/Yourmachine/yourusername/change/this/excel-example.xlsx"'
In order to change any column in the Excel file you must know which Sheet you want to operate on, then you can describe the changes to your file with the following format:
[{"cell": CELL_NAME (i.e. A11), "sheet": SHEET_NAME (i.e. "Sheet 1"), "value": anything as long as it works in excel}]
The same exact format goes for the field "select" of the form, you need to specify cell name
and sheet
(see the curl example above).
[{"cell": CELL_NAME (i.e. A11), "sheet": SHEET_NAME (i.e. "Sheet 1")}]
Download this Excel file (does nothing but the sum of some cells, check it out): https://docs.google.com/spreadsheets/d/1WuVi7F1PDpH69JWRa9bDxTHT1JaA5w43/edit?usp=sharing&ouid=113909502023297765536&rtpof=true&sd=true and place it under /Users/yourusername/Desktop/excel-example.xlsx
In the following example we are changing the cell A1 of the sheet "Sheet 1" and setting the value to the number 4:
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('changes', '[{"cell": "A1", "sheet": "Sheet 1", "value": 4}]'); // we want to change only this cell
data.append('select', '[{"cell": "A7", "sheet": "Sheet 1"}]'); // we want to read this value then
data.append('file', fs.createReadStream('/Users/yourusername/Desktop/excel-example.xlsx')); // <-- change this
var config = {
method: 'post',
url: 'https://excel-to-api.gigalixirapp.com/api/changeset',
headers: {
'Authorization': 'Bearer TOKEN', // <--- change this you find it at https://excel-to-api.gigalixirapp.com/users/settings
...data.getHeaders()
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
As you can also see, the select field contains an array of cells that we want to return as result of our changes.
The result of such call will be something like the following:
{
"response": {
"changes": {
"changes": [
{
"cell": "A1",
"sheet": "Sheet 1",
"value": 4
}
],
"file": "/tmp/plug-1631/multipart-1631468662-760532740890383-2",
"select": [
{
"cell": "A7",
"sheet": "Sheet 1"
}
]
},
"file": "/tmp/plug-1631/multipart-1631468662-760532740890383-2",
"results": {
"Sheet 1!A7": 10
}
}
}
There is no limit to the amount of cells that you read and write as long as you don't crash the machine :)
If you have any problem just write me at the contact link you find https://excel-to-apis.webflow.io/