Reputation: 31
I'm looking for a way to access elements of a cell's history. I have used various iterations of the following code to get at the keys inside the cell history dict, but I'm (obviously) doing something wrong. When running the code as below I get this error - TypeError: 'CellHistory' object has no attribute '__getitem__'
Help! This is driving me crazy!
#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`
Upvotes: 1
Views: 563
Reputation: 13480
Seems like you're using the wrong attribute name and syntax in the print
statement. Try something like this instead:
#print out revision history
for rev in revisions:
print(rev.modified_at)
print(rev.modified_by.name)
print('')
Upvotes: 2