Update Worksheet Data
- To update data in a worksheet, you need the following 3 parameters:
- 1.Token
- 2.Worksheet Id
- 3.App Id
PUT
https://api.tablesprint.com/api/platform/worksheet/row/{appId}/{worksheetId}
URL Parameters​
Parameter | Type | Required | Description |
---|---|---|---|
appId | string | Yes | The unique identifier of the application |
worksheetId | string | Yes | The unique identifier of the worksheet |
To get URL parameters follow these steps:
- 1.Click on the downward arrow beside the worksheet name.
- 2.A dialog box with options will open.
- 3.Click on More Info, and you'll see the worksheetId and AppId.
Request Body Parameters​
Parameter | Type | Required | Description |
---|---|---|---|
columnName | string | yes | The name of the column to be updated. |
value | string | yes | The new value to update the column with. |
_id | string | yes | The unique identifier of the row to be updated. |
How to know _id of the row?
- 1.To retrieve the _id of the rows, request the data using the "Get Worksheet Data" API.
- 2.Then, for each row, you will receive an _id.
Example :
- When you want to update a single row.
{
"data": [
{
"name": "Tablesprint",
"Number": "800",
"_id": "998be891af"
}
]
}
Example 2:
- When you want to update multiple rows at once, you must know the _id of each row to be updated. You need to provide the data in the request body as objects, separated by commas.
{
"data": [
{
"name": "Table",
"Number": "1200",
"_id": "998be891af"
},
{
"name": "Chair",
"Number": "800",
"_id": "998be891ba"
}
]
}
Request Headers
Header | Value |
---|---|
Authorization | Bearer YOUR_ACCESS_TOKEN |
Content-Type | application/json |
-Here is the example how to make this request:
curl -L -X PUT 'https://api.tablesprint.com/api/platform/worksheet/row/appId/worksheetid' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-d '{
"data": [
{
"columnName1": "Updated Value1",
"columnName2": "Updated Value2",
"_id":"_id of the row1"
},
{
"columnName1": "Updated Value1",
"columnName2": "Updated Value2",
"_id":"_id of the row2"
}
]
}'
Response​
A successful request returns the HTTP 200 OK
status code and JSON response body.
- results.updateCount : Represents the number of rows that were updated when upsert is set to true and a matching row already exists.
- results.insertCount : Represents the number of new rows added when no existing match is found and when upsert is set to true.
- In case you get other error codes: Refer here
{
"results": {
"updateCount": 3,
"insertCount": 0
},
"success": true
}
Response Headers
Header | Description |
---|---|
Content-Type | application/json |