智能表添加多个联系人

问题描述 投票:0回答:1

我在智能工作表中将其列为“允许选择多个联系人”。

我正在使用simple_smartsheet程序包(https://pypi.org/project/simple-smartsheet/),但我似乎在互联网上找不到任何使用此程序包添加多个联系人的人。

下面是我尝试过的一段代码:

from simple_smartsheet import Smartsheet
from simple_smartsheet.models import Sheet, Column, Row, Cell, ColumnType

#%%
access_token='XXX'
smartsheet = Smartsheet(access_token)
sheet_name = 'test'

sh = smartsheet.sheets.get(sheet_name)

new_rows = [
    Row(
        to_top=True,
        cells=[
            Cell(column_id=released_by.id, value=[{'objectType': 'CONTACT',
                                                    'email': '[email protected]',
                                                    'name': 'xxx yyy'},
                                                {'objectType': 'CONTACT',
                                                    'email': '[email protected]',
                                                    'name': 'aaa bbb'}])
        ],
    ),
]

#new_rows.append(Row(to_top=True,cells=sh.make_cells(row_value)))
smartsheet.sheets.add_rows(sh.id, new_rows)

但是我遇到了这个错误:

SmartsheetHTTPClientError: HTTP response code 400 - Error code 1008 - Unable to parse request. The following error occurred: Field "value" was not parsable. value must be a primitive type
 at [Source: java.io.PushbackInputStream@786472ed; line: 1, column: 241].

我不太确定我在哪里做错了。有什么想法吗?

python smartsheet-api
1个回答
0
投票

the python docoriginal doc,您可以看到Cell类只接受valuestringboolean作为number

所以这应该起作用:

new_rows = [
    Row(
        to_top=True,
        cells=[
            Cell(column_id=released_by.id, value="your value")
        ],
    ),
]
© www.soinside.com 2019 - 2024. All rights reserved.