#
POST - Creating Rows
You can add rows to your sheets by sending POST requests to the sheet endpoint.
Make sure you have POST method enabled in your sheet settings. See more.
#
Adding single row
You need to send a JSON object with the row data to the sheet endpoint in order to create a new row.
curl -X POST \
"https://sheetrest.com/api/v1/sheets/SHEET_ID" \
-H 'Content-Type: application/json' \
-d '{
"Name": "Bob",
"Age": 30,
"City": "New York"
}'
fetch('https://sheetrest.com/api/v1/sheets/SHEET_ID', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
Name: 'Bob',
Age: 30,
City: 'New York',
}),
});
#
Adding multiple rows
If you want to add multiple rows at once, you need to send an array of JSON objects with the row data to the sheet endpoint.
curl -X POST \
"https://sheetrest.com/api/v1/sheets/SHEET_ID" \
-H 'Content-Type: application/json' \
-d '[
{
"Name": "Bob",
"Age": 30,
"City": "New York"
},
{
"Name": "Alice",
"Age": 25,
"City": "Los Angeles"
},
{
"Name": "John",
"Age": 40,
"City": "Chicago"
}
]'
fetch('https://sheetrest.com/api/v1/sheets/SHEET_ID', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify([
{
Name: 'Bob',
Age: 30,
City: 'New York',
},
{
Name: 'Alice',
Age: 25,
City: 'Los Angeles',
},
{
Name: 'John',
Age: 40,
City: 'Chicago',
},
]),
});