开发一个工作流程,每天都会将新的电子表格上传到工作区。第二个跟踪表使用交叉表引用来填充几列。我正在尝试自动化上传过程,如果我能够编辑现有的交叉工作表引用,我可以让它指向新工作表,而不是用新引用重新填充单元格。鉴于应用程序中的引用编辑器能够更改引用的工作表和范围,对我来说,api 也有一些方法可以做到这一点是有意义的。我已阅读此处的文档:http: //smartsheet-platform.github.io/api-docs/并没有发现任何可以让我编辑参考的内容。我希望我遗漏了一些明显的东西。
我可以使用文档中提供的代码获取参考列表并检索特定的参考。如有必要,我还可以更改给定行中的单元格,但这增加了我想避免的复杂程度。
这是我用来检索和添加交叉表引用的代码
Wrksps = get_workspace_list()
for space in Wrksps:
if space.name == 'QC':
qc_space = space
QC_sheets = get_sheet_list(qc_space.id,'w')
for sheet in QC_sheets:
if sheet.name == 'QC Active Issues':
active_sheet = sheet
active_sheet = get_object(active_sheet.id, 's')
issue_sheet = get_object(Referenced sheet ID, 's')
for col in issue_sheet.columns:
if col.title == 'Work Order ID':
WO_col = col
if col.title == 'Unstartable':
last_col = col
xref = smartsheet.models.CrossSheetReference({
'name': 'Sample Time Log Sheet Range 1',
'source_sheet_id': Referenced sheet ID,
'start_row_id': ROW ID,
'end_row_id': ROW ID
'start_column_id': start_col.id,
'end_column_id': last_col.id
})
result = smart_sheet_client.Sheets.create_cross_sheet_reference(active_sheet.id, xref)
print(result)
result = smart_sheet_client.Sheets.list_cross_sheet_references(active_sheet.id)