Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,046 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to use the MS Graph API to add a row to an Excel file on Sharepoint, but for some reason my request body gets the error AttributeError: 'list' object has no attribute 'serialize'.
The way I defined it is the same as in the documentation on learn.microsoft.com about the Graph API.
My code is:
tableid=await self.user_client.drives.by_drive_id(parent_drive_id).items.by_drive_item_id(src_item_id).workbook.tables.get()
request_body = WorkbookTableRow(
index = 5,
values = [
[
1,
2
],
[
4,
5
],
],
)
workbooktableid=tableid.value[0].id
result = await self.user_client.drives.by_drive_id(parent_drive_id).items.by_drive_item_id(src_item_id).workbook.tables.by_workbook_table_id(workbooktableid).rows.add.post(request_body)
I have tried changing the values part to a dictionary, dataframe and json but none of those work. And if I change it it gives me for instance 'dict object has no attribute 'serialize''. Does anyone have an idea how to correctly define the request body?