In this article we will be seeing how to access the Tables and REST API Return
Formats. Here is Part 2
Table:
URL Structure:
We can access resources like charts, PivotTables, tables, and named ranges in a
workbook directly through a URL using REST API. Each REST URL in Excel Services
is built of three parts.
- REST aspx Page URI The entry point to an .aspx
page
- Workbook Location The path to the workbook
- Resource Location The path to the
requested resource inside the workbook
Example:
http://servername:1111/sites/VJTesting/_vti_bin/excelrest.aspx/Shared%20Documents/ExcelChart.xlsx/model
REST aspx Page URI - http://servername:1111/sites/VJTesting/_vti_bin/excelrest.aspx
Workbook Location - /Shared%20Documents/ExcelChart.xlsx
Resource Location- /model
We can use the resource location to get the particular element from the excel
workbook.
Tables:
In this section we will be seeing how to access the tables using the REST URL.
REST URL:
http://serverName:1111/sites/VJTesting/_vti_bin/excelrest.aspx/Shared%20Documents/ExcelChart.xlsx/model/Tables('EmpDetails')
REST aspx Page URI - http://servername:1111/sites/VJTesting/_vti_bin/excelrest.aspx
Workbook Location - /Shared%20Documents/ExcelChart.xlsx
Resource Location- /model/Tables('EmpDetails')
The output will be as shown in the following
REST API Return Formats:
REST API supports the following return formats
?$format=html -
REST API returns an HTML representation of
the item that can be displayed by the web browser.
?$format=atom -
REST API returns an ATOM feed representation of the
item.
?$format=image -
REST API returns an image file (format is always
PNG).
?$format=workbook -
REST API returns the workbook which can then be
opened in Excel or saved.
Item |
Format |
/ModelBottom
of Form |
?atom, ?workbook |
/Model/Ranges |
?atom |
/Model/Ranges('RangeName') |
?atom, ?html |
/Model/Charts |
?atom |
/Model/Charts('ChartName') |
?atom, ?image |
/Model/Tables |
?atom |
/Model/Tables('TableName') |
?atom, ?html |
/Model/PivotTables |
?atom |
/Model/PivotTables('PivotTableName') |
?atom, ?html
Bottom of Form |