Using the python library and the 2.0 API docs. I am trying to add a row but keep getting the error: "message": "Required object attribute(s) are missing from your request: row.id."
The problem seems to be with the new_row.to_bottom=True
statement. Am I mis understanding or is there an error in the API?
I also noticed that when I added to_top
in the same call, the message came back with only toTop or toBottom in a single call.
I tried again with that syntax and still no luck.
import smartsheet
...
new_row = ss_client.models.Row()
new_row.to_bottom = True #also tried .toBottom=True
new_cell = ss_client.models.Cell()
new_cell.column_id = 9380123454964
new_cell.value = 'update'
new_cell.strict = False
new_row.cells.append(new_cell)
updated_row = ss_client.Sheets.update_rows(1234567,[new_row]) #also tried new_row outside of []
Response: {
status: 400 Bad Request
content: {
{
"detail": {
"index": 0
},
"errorCode": 1012,
"message": "Required object attribute(s) are missing from your request: row.id.",
"refId": "152g54q6e89sd"
}
}
Anyone know how to fix this? is the SDK still on 1.0 or something?
You're attempting to update a row that doesn't exist yet. Until the row has actually been created, you don't know what the row id is, because it hasn't been assigned one by the server. Replace update_rows
with add_rows
.
ss_client.Sheets.add_rows(<sheet_id>,[new_row])