访问单元历史记录(python、smartsheets)

2024-05-29 03:00:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我在寻找一种方法来获取细胞的历史记录。我使用了以下代码的各种迭代来获取单元历史dict中的键,但是(显然)我做错了什么。当运行下面的代码时,我得到这个错误-TypeError: 'CellHistory' object has no attribute '__getitem__'

救命啊!我快疯了!在

#get the cell history
action = smartsheet.Cells.get_cell_history(
    sheetid,
    sheet.rows[1].id,
    columns[1].id,
    include_all=True)

 revisions = action.data

#print out something from revision history
for rev in revisions:
    print rev['modifiedAt'] #breaks here`

Tags: 方法代码id历史记录getrevcellaction
1条回答
网友
1楼 · 发布于 2024-05-29 03:00:52

似乎您在print语句中使用了错误的属性名和语法。试试这样的方法:

#print out revision history
for rev in revisions:
    print(rev.modified_at)
    print(rev.modified_by.name)
    print('')

相关问题 更多 >

    热门问题