Read Data from Sheet
You can access your sheet's complete data in JSON.
Find your API's URL in your dashboard. Perform a GET
request to [your API URL]/[sheet name]
to retrieve your complete data.
Let's read the contents of Sheet1 of the Blog Posts API we created earlier.
# Read Sheet1
$ curl "https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40/Sheet1"
# Response ↓ (trimmed for brevity)
# [{"title":"Why the Best Things in Life Can’t Be Planned","content":"Thales of Miletus, considered ...","link":"https://medium.com/...","author":"Zat Rana"}, {...}, ...]
// Read Sheet1
const SteinStore = require("stein-js-client");
const store = new SteinStore(
"https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40"
);
store.read("Sheet1", { limit: 1, offset: 2 }).then(data => {
console.log(data);
});
// Logs ↓ (trimmed for brevity)
// [{"title":"Why the Best Things in Life Can’t Be Planned","content":"Thales of Miletus, considered ...","link":"https://medium.com/...","author":"Zat Rana"}, {...}, ...]
<script src="https://unpkg.com/stein-js-client"></script>
<script>
const store = new SteinStore(
"https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40"
);
store.read("Sheet1", { limit: 1, offset: 2 }).then(data => {
console.log(data);
});
// Logs ↓ (trimmed for brevity)
// [{"title":"Why the Best Things in Life Can’t Be Planned","content":"Thales of Miletus, considered ...","link":"https://medium.com/...","author":"Zat Rana"}, {...}, ...]
</script>
Optional request parameters
You can optionally limit and offset your response.
Parameter | Description | Type |
---|---|---|
limit | Maximum number of rows to be returned | Number (Integer) |
offset | Index of row from which response should start (default is 0) | Number (Integer) |
# Read Sheet1, with a limit and an offset
$ curl "https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40/Sheet1?limit=1&offset=2"
# Response ↓ (trimmed for brevity)
# [{"title":"The Awkward Power Dynamics...","content":"The other night, I was...","link":"https://medium.com/...","author":"Deanna Pai"}]
// Read Sheet1, with a limit and an offset
const SteinStore = require("stein-js-client");
const store = new SteinStore(
"https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40"
);
store.read("Sheet1", { limit: 1, offset: 2 }).then(data => {
console.log(data);
});
// Logs ↓ (trimmed for brevity)
// [{"title":"The Awkward Power Dynamics...","content":"The other night, I was...","link":"https://medium.com/...","author":"Deanna Pai"}]
<script src="https://unpkg.com/stein-js-client"></script>
<script>
const store = new SteinStore(
"https://api.steinhq.com/v1/storages/5cc158079ec99a2f484dcb40"
);
store.read("Sheet1", { limit: 1, offset: 2 }).then(data => {
console.log(data);
});
</script>
Return value
An array of objects, with each object representing the sheet rows.