使用 Graph API + Python 请求工作表单元格值

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

下面是我的代码片段。使用请求库。


url = 'https://graph.microsoft.com/v1.0/sites/' + siteid+ '/drive/items/' + itemid + 'workbook/worksheets/Sheet1/range/cell(row=5,column=6)'
headers = {
  'Authorization': 'Bearer ' + access_token
}

# Make a GET request to the provided url, passing the access token in a header
graph_result = requests.get(url=url, headers=headers)

# Print the results in a JSON format
print(graph_result.json())

出现以下错误,我不知道如何解决。 {'error':{'code':'BadRequest','message':“OpenTypes 不支持打开导航属性。属性名称:'cell'。”,'innerError':{'date':'2024-07 -23T19:42:36', '请求 ID': 'e257e0b8-5204-4ab6-aaea-e5d72d96bb1a', '客户端请求 ID': 'e257e0b8-5204-4ab6-aaea-e5d72d96bb1a'}}}

我希望得到包含单元格值的 json。自行请求项目 ID,它确实响应正确。我不知道如何修复 OpenTypes 不支持打开导航属性的错误。

python sharepoint python-requests microsoft-graph-api
1个回答
0
投票

我认为您在 URL 路径中的

/
之前缺少斜杠
workbook

url = 'https://graph.microsoft.com/v1.0/sites/' + siteid+ '/drive/items/' + itemid + '/workbook/worksheets/Sheet1/range/cell(row=5,column=6)'
© www.soinside.com 2019 - 2024. All rights reserved.