I have completed my first sharepoint 2013 app (sharepoint hosted) where I'm using my own code to display list data etc rather than use any OTB pages/functionality.

The one feature I want to include from the OTB ribbon is the export to excel feature but I can't see any examples of this on MSDN, has anyone managed to do this via Javascript or JQuery?



For anyone interested this is how i did it!

Function to get my lists and views

function getLists() {
lists = web.get_lists();
context.load(lists, "Include(Id, Title, Hidden, ItemCount, Views)");
context.executeQueryAsync(onSuccess, onFail);

Function to get list and build link

function onSuccess() {

var listsEnum = lists.getEnumerator();
while (listsEnum.moveNext()) {
    var list = listsEnum.get_current();

    if (list.get_title() == "Name of list") {
        var title = list.get_title();
        var viewCollection = list.get_views();
        var viewInfo = 'Tasks list current views: \n\n';
        var viewEnumerator = viewCollection.getEnumerator();
        while (viewEnumerator.moveNext()) {
            var view = viewEnumerator.get_current();
            if (view.get_title() == "View-Title") {
                var viewGUID = view.get_id();
                //Add the export link
                $('#lnkExport').attr("href", "../_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=" + list.get_id().toString() + "&View=" + viewGUID + "&CacheControl=1");






1 Answer 1


I think this might help:


Tested on SP2010

To replicate the funtionallity of "Export to Excel" (obtain the iqf file), all that needs to be done is replacing the place holders with your environment information in the following link:




Regards, David

  • Please do not post link-only answers. The answer will be of no help if the link breaks. Instead, add the important bits from the link to your answer (with a clearly visible source off-course) Feb 11, 2014 at 15:10
  • Sure, i will edit the response. Feb 11, 2014 at 15:22
  • You think this dll is available in 2013?
    – Stephen
    Feb 11, 2014 at 17:18
  • Yes, i don't have a SP 2013 environment available right now to test, but accordingly to this books.google.fr/… it is available. Feb 12, 2014 at 9:19
  • Ok had some time to look at this and i don't think this will work as we don't know the List or view guid until we deploy.
    – Stephen
    Feb 12, 2014 at 15:38

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.