TableCollection: add

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.

Prerequisites

The following scopes are required to execute this API:

HTTP request

POST /workbook/tables/add
POST /workbook/worksheets(<id|name>)/tables/add

Request headers

Name Description
Authorization Bearer

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.

Response

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

Example

Here is an example of how to call this API.

Request

Here is an example of the request.

POST https://graph.microsoft.com/v1.0/me/drive/items/{id}/workbook/tables/add
Content-type: application/json
Content-length: 54

{
  "address": "address-value",
  "hasHeaders": true
}
Response

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"
}