I'm trying to create a table in excel using graph api but I'm not able to set the table name.
POST call: https://graph.microsoft.com/v1.0/drives/b!4IXXX-XXX/list/items/39/driveitem/workbook/worksheets('MeTest')/tables/add
Header: Content-type: application/json
BODY:
{
"address": "OFFSET('MeTest'!A1,0,0,SUBTOTAL(103,'MeTest'!$A:$A),17)",
"hasHeaders": true,
"name":"MYTABLE"
}
I have tried, ...tables("MYTABLE"), tables('MYTABLE'), tables/MYTABLE/add but nothing seems to work. The post is a success but the system names the table Table2
This a limitation of the workbook API. When creating a new table, the name is set automatically.
You need to make another call to update the table and change the name
PATCH https://graph.microsoft.com/v1.0/drives/{drive_id}/list/items/{item_id}/driveitem/workbook/worksheets('{sheet_name}')/tables/{table_id}
{
"name":"MYTABLE"
}