Monday, 4 June 2012

Use Excel Rest API in SharePoint 2010

Step 1)  Upload following .xlsx file to  ShareDocument Library in Share Point site
  Select  A1-D4 cells  name it as SalesDetails(Shown in arrow 1)
   By default Graph has  "Chart 1" as name, leave it.

Step 2) Upload this Excel Sheet to  Document Library
Step 3)  Calling Excel REST API  to access Sales-Details.xlsx file stored in document library

               3.1) Using Excel Rest API  , access SalesDetails pivot table
               3.2) Using Excel Rest API, access only Chart display in WebPage/Browser.

Step 4)  Using Excel REST API.
                   in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI  folder
          There is a file called "ExcelRest.aspx"  which is used to access Excel files in Sharepoint site,

         Using Excel Rest API  , access SalesDetails pivot table
       to Access ExcelRest.aspx  
                type site address http://sp2010:27567/_vti_bin/ExcelRest.aspx


So to Access Sales-Details.xlsx stored in Shared-Document Library 
http://sp2010:27567/_vti_bin/ExcelRest.aspx/Shared%20Documents/Sales-Data.xlsx/Model


just append  Shared%20Documents/Sales-Data.xlsx/Model


it will return  atom xml shown below format 


Accessing pivottable SalesDetails
http://sp2010:27657/_vti_bin/ExcelRest.aspx/Shared%20Documents/Sales-Data.xlsx/Model/Ranges('SalesDetails')?format=HTML


just append Ranges('SalesDetails')?$format=HTML




               3.2) Using Excel Rest API, access only Chart display in WebPage/Browser.

http://sp2010:27657/_vti_bin/ExcelRest.aspx/Shared%20Documents/Sales-Data.xlsx/Model/Charts('Chart 1')?$format=image

just append Charts('Chart 1')?$format=image

No comments:

Post a Comment