0

我只是在做一个简单的 add_rows 请求,需要将 overrideValidation 设置为 True,这样插入就不会因为 Picklist 列上的拼写错误而失败。

   row.to_top = True
   row.cells.append({
       #date of service
       "columnId": column_id,
       "displayValue": "not a doc",
       'strict': False
   })
   row.cells.append({
       #Summary Finished
       "columnId": column_id2,
       "value": True
   })
   response = smartsheet_client.Sheets.add_rows(
       sheet_id,       # sheet_id
       [row],
       )

响应:{ status: 400 Bad Request content: { { "errorCode": 5536, "message": "The value \"not a doc\" could not be saved in column \"Prescribing MD\". 此列仅限于仅 PICKLIST 值。", "refId": "195gawcb3hbup" } } {"result": {"code": 5536, "errorCode": 5536, "message": "The value \"not a doc\" could not be保存在 \"Prescribing MD\" 列中。此列仅限于 PICKLIST 值。", "name": "ApiError", "recommendation": "不解决问题就不要重试。", "refId": "195gawcb3hbup ", "shouldRetry": false, "statusCode": 400}}

4

1 回答 1

1

overrideValidation在要覆盖的每个单元格中包含参数。

   row.cells.append({
       #date of service
       "columnId": column_id,
       "displayValue": "not a doc",
       "overrideValidation": True,
       'strict': False
   })

有关可以包含哪些参数的更多详细信息,请参阅API 文档。

请注意,您必须是工作表的管理员才能覆盖验证。此外,请考虑通常专门启用数据验证以防止诸如拼写错误之类的值输入其他干净的数据。如果这不是您需要的优先事项,您可能需要考虑关闭验证,而不是尝试绕过它。

于 2019-09-03T18:51:34.223 回答