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
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI'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
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/
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.
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>