TableCollection: add

Namespace: microsoft.graph

Create a new table. The range source address determines the worksheet under which the table will be added. If the table cannot be added (e.g., because the address is invalid, or the table would overlap with another table), an error will be thrown.

Error Handling

This request might occasionally receive a 504 HTTP error. The appropriate response to this error is to repeat the request.


One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Files.ReadWrite
Delegated (personal Microsoft account) Not supported.
Application Not supported.

HTTP request

POST /workbook/tables/add
POST /workbook/worksheets/{id|name}/tables/add

Request headers

Name Description
Authorization Bearer {token}. Required.
Workbook-Session-Id Workbook session Id that determines if changes are persisted or not. Optional.

Request body

In the request body, provide a JSON object with the following parameters.

Parameter Type Description
address string Address or name of the range object representing the data source. If the address does not contain a sheet name, the currently-active sheet is used.
hasHeaders boolean Boolean value that indicates whether the data being imported has column labels. If the source does not contain headers (i.e,. when this property set to false), Excel will automatically generate header shifting the data down by one row.


If successful, this method returns 200 OK response code and WorkbookTable object in the response body.


Here is an example of how to call this API.


Here is an example of the request.

Content-type: application/json
Content-length: 54

  "address": "Sheet1!A1:D5",
  "hasHeaders": true

Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 109

  "id": "99",
  "name": "name-value",
  "showHeaders": true,
  "showTotals": true,
  "style": "style-value"