Introduction to the SharePoint Excel Services REST API

Source: Internet
Author: User
Tags ranges

Original: SharePoint Excel Services REST API Introduction

Introduction: The REST API in Excel Services is a new addition to Microsoft SharePoint Server 2010. With the REST API, you can access the workbook parts or elements directly through a URL.

First, REST The service is based on two requirements:

Addressing scheme for locating network resources

Methods for returning representations of these resources

Second, REST URL Basic URI The three components are:

REST aspx page uri:http://<servername>/_vti_bin/excelrest.aspx

Workbook Location:/docs/documents/sampleworkbook.xlsx

Resource location:/model/ranges (' Nameofthenamedrange ')

Third, API simple applications and examples:

1. Cell Display:

Example: Http://URL/_vti_bin/ExcelRest.aspx/DocLib1/ExcelTest.xlsx/model/Ranges (' A1 ')

Attached: Full Excel

2. Chart Display

Example: Special description " %e5%9b%be%e8%a1%a8%201"= =" Figure 1" meaning, after the URL encoding

Http://URL/_vti_bin/ExcelRest.aspx/DocLib1/ExcelTest.xlsx/Model/Charts ('%e5%9b%be%e8%a1%a8%201 ')

Attached: the original Excel screenshot

3, cell range display (Excel, range selection will not show the chart)

Example: Http://URL/_vti_bin/ExcelRest.aspx/DocLib1/ExcelTest.xlsx/Model/Ranges (' a1| M5 ')

Special:sheet2! A1%7CM5, the underlined section, you can choose the worksheet, half-width exclamation mark separation;

4. The cell range shows and sets the value of a cell

Example: (the original Excel as shown in Excel above) http://URL/_vti_bin/ExcelRest.aspx/DocLib1/ExcelTest.xlsx/Model/Ranges (' sheet2! A1%7cn5 ')? Ranges (' sheet2! N2 ') =88&ranges (' sheet2! N3 ') =98

Iv. return Atom of the XML format

Through the returned XML file, we can do the next coding in the code, can be based on a published Excel file for statistics, display and so on.

Example: ($format =atom parameters)

Http://URL/_vti_bin/ExcelRest.aspx/DocLib1/ExcelTest.xlsx/Model/Ranges (' sheet2! A1%7cn5 ')? Ranges (' sheet2! N2 ') =88&ranges (' sheet2! N3 ') =98& $format =atom

Right-click to view the source file:

Special: Because the complete XML code occupies too much space, so only to intercept the current screen, please forgive me!

Five, Excel Services REST API features not supported in the

The following is a partial list of several important features that are not currently supported or used in the Excel Services REST API:

· no floating chart. If a range contains a diagram, and you request the scope through REST, only that range is obtained.

· no sparkline, no icon conditional formatting. not currently supported.

· no pixels (ideal EWA ). the HTML generated by REST is similar to the HTML generated by Excel Web Access. However, the Excel Services REST API does not have access to all of the cascading style sheet (CSS) elements that Excel Web Access can access. The Excel Services REST API returns an HTML fragment. This HTML fragment must be self-contained.

· There are no differences in the table. when you request a table as Atom to see whether a cell or data is a column header, grand total, or regular data, there is no difference in the table. That is, there is no difference between the specified cell or whether the data is header, grand total, or regular data. All table cells in the table will be treated equally.

· URL size limit. the URL size will be limited to about 2000 characters. This means that if you have a large number of parameters in your workbook, you may not be able to set all parameters. This occurs especially if the workbook is located in a lower position in the folder structure.

· special characters. does not support such as "?" and "#" characters. To correctly reference a worksheet name that contains special characters, when you reference a formula to a worksheet with special characters, the basic principle is "understand what the Excel client does" and follow the appropriate example.

Conclusion:

This article is a simple example of a reference to the MSDN SDK documentation and, if you have questions, refer to the attached reference; for the Excel Services REST API, you've overturned the impression that Excel Services can only be displayed on the web, but can also be based on this feature. Simple development of some new applications.

Reference documents:

An overview of the Excel Services REST API

http://msdn.microsoft.com/zh-cn/library/ee556842 (v=office.14). aspx

Resource URI for Excel Services REST API

http://msdn.microsoft.com/zh-cn/library/ff394530 (v=office.14). aspx

Introduction to the SharePoint Excel Services REST API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.