Add Rows to Sheet
Send a JSON object via a POST
request to your sheet's API URL to add data to your sheet.
Structuring the JSON
Create an array of objects representing your rows.
For example, the Blog Posts Sheet should be provided an array as such.
[
{
"title": "Awesome article",
"author": "Me!",
"content": "A brief summary",
"link": "blog.me.com/awesome-article"
}, ...
]
Performing the request
Here's an example request:
# Adds a row to spreadsheet
$ curl "https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40/Sheet1" \
-X POST \
-H "Content-Type: application/json" \
-d '[{"title": "...", "author": "...", ...}, ...]'
// Search Sheet1
const SteinStore = require("stein-js-client");
const store = new SteinStore(
"https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40"
);
store
.append("Sheet2", [
{
title: "Awesome article",
author: "Me!",
content: "A brief summary",
link: "blog.me.com/awesome-article"
}
])
.then(res => {
console.log(res);
});
<script src="https://unpkg.com/stein-js-client"></script>
<script>
const store = new SteinStore(
"https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40"
);
store
.append("Sheet2", [
{
title: "Awesome article",
author: "Me!",
content: "A brief summary",
link: "blog.me.com/awesome-article"
}
])
.then(res => {
console.log(res);
});
</script>
Return Value
The updated range of your sheet is returned. For example,
{ "updatedRange": "Sheet1!A6:D6" }