无法在 Smartsheet 中写入单元格值

cannot write cell values in Smartsheet

我已经能够使用 Python Smartsheet SDK 读取工作表、行、列和单元格,但实际上我无法 change/write/update 单元格值。我已经大大简化了我的代码,剩下的是:

import smartsheet
MySS = smartsheet.Smartsheet(MyApiKey)
single_row = MySS.Sheets.get_row(SHEET_ID, ROW_ID)
destination_cell = single_row.get_column(DST_COLUMN_ID)
destination_cell.value = "new value"
single_row.set_column(destination_cell.column_id, destination_cell)
MySS.Sheets.update_rows(SHEET_ID, ROW_ID)

当我 运行 这段代码时出现以下错误:

    Traceback (most recent call last):
  File "C:/Users/XXXXXX/Python/Smartsheet/test.py", line 24, in <module>
    MySS.Sheets.update_rows(SHEET_ID, ROW_ID)
  File "C:\Users\XXXXXX\Python\virtualenv PC Smartsheet\lib\site-packages\smartsheet\sheets.py", line 961, in update_rows
    for item in _op['json']:
TypeError: 'long' object is not iterable

我尝试将最后一行代码中的 ROW_ID 作为 ROW_ID[ROW_ID] 以及 [ROW_ID,] 传递,但仍然出现相同的错误。

我用这个作为参考:http://smartsheet-platform.github.io/api-docs/?python#update-row(s)

我做错了什么?

你太接近了!与其将 ROW_ID 发送到 update_rows(),不如将 row 对象发送到列表中。

因此,在您的情况下,您只想将最后一行更改为

MySS.Sheets.update_rows(SHEET_ID, [single_row])