0

I'd like to know if there are a way to export to excel the selected items in a sharepoint list

i'm in sharepoint 2010

1
  • The solution works just fine in SP 2013 however if I select all by changing default view as 100 items, it only saves first 30 items. If I filter less than 30, it works just fine. Any idea of exporting complete selected items? I beleive default item display is 30 is what it collects. I tried forcing 200 items view set, made default view with 200 items without success. It only saves first 30 items. Please let me knwo if you have any modifications.
    – Swati Sri
    Commented Jan 25, 2022 at 4:29

3 Answers 3

1

i finally found a solution. I've created a ribbon with javascript. it creates a view with selected items (making is query) then i use the url to export and after a time, i delete the view.

It can be use on any list

    <script type='text/javascript'>
var view; 
var url = decodeURIComponent(document.URL); 
var context = SP.ClientContext.get_current();
var selectedItems = SP.ListOperation.Selection.getSelectedItems(context); 
var web = context.get_web();
var lists = web.get_lists(); 
var listId = SP.ListOperation.Selection.getSelectedList();
var list = lists.getById(listId);
var viewcollection = list.get_views();
var viewInfo = new SP.ViewCreationInformation();
viewInfo.set_title("exporter");viewInfo.set_personalView(true);
var query = "<Where><In><FieldRef Name='ID' /><Values>";
var selectedItems = SP.ListOperation.Selection.getSelectedItems();
var i;
for (i in selectedItems) {
    query += "<Value Type='Counter'>" + selectedItems[i].id + "</Value>";
}
query += "</Values></In></Where>"; 
viewInfo.set_query(query);
viewcollection.add(viewInfo);
context.load(viewcollection);
context.executeQueryAsync(OnSuccessCurview,OnFailureCurview);
function OnSuccessCurview(){
    view = list.get_views().getByTitle("exporter");
    context.load(view);
    var viewId;
    context.executeQueryAsync(OnSuccess,OnFailure);
    function OnSuccess(){
        viewId = view.get_id();
        listId = listId.substring(1,listId.length-1).replace(/-/g,"%2D");
        var urlExport = "http://w50018003l/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=%7B"+listId+"%7D&View=%7B"+viewId+"%7D&CacheControl=1";
        console.log(urlExport);
        window.open(urlExport);
        //wait 10 seconds to delete temporary view use to export
        setTimeout(deleteView,10000);
        function deleteView(){
            view.deleteObject();
            view.update();
            context.executeQueryAsync(OnSuccessdelview,OnFailuredelview);
            function OnSuccessdelview(){
                console.log("temporary view successfully deleted");
            }
            function OnFailuredelview(){
                console.log("error during delete of temporary view");
            }
        }
    }
    function OnFailure(){
        alert("error");
    }
}
function OnFailureCurview(){
    alert("error");
}
</script>
0

You can't export selected items, even if you use the columns to filter them. You only export a whole view.

If you need to update items, you can't do it with office 2010, but you can do it with office 2003. Weird....

You can find more information on the following book: http://books.google.gr/books?id=MLWXFEFisHIC&pg=PA371&lpg=PA371&dq=%22sharepoint+2010%22+export+to+excel+%22excel+2003%22&source=bl&ots=gXiWsN9iLn&sig=-LZunrUwep3embIDuaGI83bPpKI&hl=en&sa=X&ei=7rAYVOOnGeb4yQP0l4CYBw&ved=0CCAQ6AEwAA#v=onepage&q=%22sharepoint%202010%22%20export%20to%20excel%20%22excel%202003%22&f=false

P.S. It's possible with excel 2010 - read http://meetdux.com/2010/03/30/sync-excel-sharepoint-2010/

0

If i don't remember it wrong, you can do it by first create an list view (private or public) to filter out only the items that you want, and then use the "export to excel" option in the toolbar. This should get you only the items present in the list view.

Or you just could export the whole list to excel and remove the rows that you don't need anymore, or do filter the excel sheet to show only the items you want to.

Filter for unique values or remove duplicate values (Excel)

2
  • Export to Excel is one way. Changes to the data in Excel will never be saved back to SharePoint. Microsoft removed that functionality with SP 2010 and to get it back you need to install an Excel add-in.
    – teylyn
    Commented Sep 16, 2014 at 20:35
  • Thanks for the heads-up. I really wondered why i always got a connection and it seems that we have this add-in. I'l update my answer. Commented Sep 17, 2014 at 9:08

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.