Malformed Value Error on Script to Update Sheet
Hello! I am writing a script that attempts to lock a single sheet within a spreadsheet using the Partially update a single sheet API.
Here is the chunk of code I am using to replace the lock value:
patch_body = [
{
"op": "replace",
"path": "/lock",
"value": "locked"
}
]
I've also tried using "/locked" for the path and "true" for the value instead of the above.
However, I continue to get a 400 error that reads:
Failed to lock sheet: 400 {"code":"MalformedValue","details": [{"code":"MalformedValue","message":"resource must be one of the specified enumerator values","target":"/0"}],"documentationUrl":"https://developers.workiva.com/2022-01-01/partiallyupdateprototypesheetbyid.html?rel=error","message":"invalid operation"}.
My questions are: Is there a better API endpoint to use for this type of operation? And why could I be getting these 400 errors when using the documented PATCH operations supported for this endpoint?
0
-
Hi Talia Test,
Try changing value to "lock" to lock the whole sheet. It is expecting a SheetLockType.
[
{
"op": "replace",
"path": "/lock",
"value": "lock"
}
]Thanks,
Jeff0Jeff Hickey Thank you - this worked! Do you know if there is a way to unlock a sheet? I tried using "unlock" and "none" for the value, but no luck...
0Hi Talia Test,
Glad that worked. Yes, to unlock a sheet, pass null value Here is an example body for the request to unlock a sheet:
[
{
"op": "replace",
"path": "/lock",
"value": null
}
]Thanks,
Jeff0Iniciar sesión para dejar un comentario.
Comentarios
3 comentarios