2

I need to call excel service rest api as follows on the 'Summary' library in hostweb

"https://<sponline>/sites/dev/_vti_bin/ExcelRest.aspx/Summary/Group%20Summary%202014.xlsx/Model/Tables('Revenue_Jan')?$format=atom"

The call should be executed from a SharePoint hosted app using JavaScript. I'm getting 'access denied' error when using below code in SharePoint hosted app.

$.ajax({
        type: "GET",
        url: hostweburl + "/_vti_bin/ExcelREST.aspx/Summary/Group%20Summary%202014.xlsx/model/Tables?$'format=html'",
        success: function (data) {
            alert("success");
        },
        error: function (xhr, msg, e) {
            alert("error");
        }
    });

If someone can point out a JavaScript code sample on how to use excel service from SharePoint hosted app it will be very helpful.

2
  • Where you able to get this working? Please share the source code if you do. Thanks, Karthik
    – user29641
    Commented Jun 13, 2014 at 11:38
  • The issue is almost certainly with not passing the right headers to authenticate.
    – Kyle Hale
    Commented Mar 30, 2016 at 4:19

1 Answer 1

0

Couldn't continue investigating how to do this on SharePoint app. I finally used a normal SharePoint webpage with following JavaScript.

$.ajax({
        url: "../_vti_bin/ExcelRest.aspx/GroupStatistics/Group%20Summary%202014.xlsx/model/Tables('" + tableName + "')?$format=json",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        dataType: "json",
        success: function (data) {
            //work with data
        },
        error: function (data) {
           // error
        }
    });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.