SharePoint 2010 - Export selected items to excel

In the SharePoint 2010 sites users will be able to export the custom list items to excel using the export to excel option in ribbon toolbar. It will export all the items in that particular view in which the option is invoked. SharePoint literally is not exporting the items it creates iqy query file instead, which will have the view id and helps to query the SharePoint list data and the results are shown in the excel spreadsheet.

Now if I have a requirement something like, I need to export only specific items from the list. Let's say I want to export only 10 items out of 30 items shown in the view then there is no direct option for that. I need to create a view and apply filter to extract only the specific 10 items which I want to export. But I can' t create views every time to export any specific items. What if I don't have appropriate permissions to create views? To overcome these kind of issues, I have created a component which will export the specific items from the custom list. Its a custom action which will create the "Export to excel" ribbon button. Just selected the items and click on the button in the ribbon to export the items.


How to
  1. Deploy the Rjesh.Solutions.wsp to the concerned web application
  2. Go to site features and activate the feature "Export Selected Items to Excel"
  3. Use the export functionality in the custom list

Demo Video


Download

You can download the WSP and code from here

Update

You can download and read about the latest release over here http://gallery.technet.microsoft.com/SharePoint-2010-Export-ede385b9/file/97734/2/Rjesh.Solutions.wsp

59 comments

Anonymous mod

how to remoave id;# from lookup column or personal or group

Reply

hi can you please send me a wsp file to my mail id, since i do not have permission to download anything from here. please help me.

Reply

@ramanjulu, please share your email id.

Reply

Hi Rajesh,
Thanks a lot for your quick reply. at last i have deployed the solution and activated the feature, but i do not see the icon(ExportToExcel) in the ribbon. i have checked 14\images\ExcelIcon.png is also available. Can you please guide me what could be the reason. this is my mail id: "ramanjulu.n@isgn.com"

Reply

@ramanjulu,the button will be shown in the items tab in the custom list ribbon. If the feature was properly activated. About the image you should check inside the \Images\Rjesh.Solutions\ folder structure in the 14 hive. Hope this helps.

Reply

Hi Rajesh,

I need this button to be displayed in the document library(library category can be anything). can this be done? Please suggest.

Reply

hi rajesh,

this feature is available for document library or can we assign this feature to doument library in the coding itself. if yes, please help me how to do this.

Reply

@Ramanjulu, you can make it work for the document library with some changes to the ExportSelectedItems element.xml.
1. Change the registration ID to 101 - which will set it for document library
2. Change the CustomUI Defintion where you want to show the button in the Document library ribbon.

If time permits I will post a blog with the screenshots. Happy coding

Reply

Thank you so.........much Rajesh, i have succeeded by doing so. but there is a problem in exporting. I have two "lookup" columns. when i export the list items(selected or all) to excel, these two lookup columns not exporting exactly what is there in the list. lets say i have "Vendor" in one lookup column, after exporting it will be "2;#Vendor". so i want to see only Vendor not the symbols and numbers. i do not know from where it is capturing numbers and symbols. other list column has "Cordy, Inc", in excel "1009;#Cordy, Inc". please guide me.

Reply

Its fixed in the Release 1.1.0 along with the other issues. You can download the latest 1.1.0 WSP from here http://bit.ly/V69LMt

Reply
Lisa Simmons mod

@Rajesh, good job!
Trying to change the project to export all of the list items. I got it working in a Standard View, but the code breaks in Datasheet View. What updates need to be made to the .js file?

Reply

@Lisa, Thanks for the comments.
This components has been designed for the standard view. In the data sheet view, the client object model's getSelectedItems api won't work. I'll disable (gray out) the export button in the ribbon like other out of the box controls. Mean while I look for alternatives to achieve this in Data sheet view. Please subscribe through Facebook/Feeds for the updates.

Reply

Hey Rajesh, this is a great solution. But I have one question. Can I export the entire view with this feature and not only the selected items? I have a problem with the default "Export to Excel" button, so I am trying to do this with your solution.
Thanks, Boris

Reply

@Boris, you can use the select all and export all the items in the page using this feature. It won't export all the items in the view. The contents in the might be folded in multiple pages with the pagination. This feature can export the items in that particular page only.

Reply

Hi Rajesh,

I notice that this only works to items in a list directory. How can I export items that are inside a site page. Thanks!

Reply
Roland Javet mod

Hey Rajesh, this is a great solution. But I have one question. The export hungs as soon as I select an item that has a value in a managed metadata column? Can you help me?
Thanks, Roland

Reply

@Roland which version are you using? Can you try the 1.1.0 version?

Reply
Roland mod

Hi Rajesh,
Yes I have downloaded the 1.1.0 version and I did modify the code so that I can use on different type of tables. I will start debuging the code but i just wanted to know if you had the same issue.
Thanks
Roland

Reply

It's fixed in the latest version 1.1.0. So your debugging should help.

Reply
Anonymous mod

It doesn't work in record center site library

Reply

Never tried with record center, good catch. will fix it soon.

Reply
Anonymous mod

Hi Rajesh!

Great solution thank you so much, it help me alot.
Hope this solution will eventually support some metadata fields.

God Bless.

Reply
Anonymous mod

Hi Rajesh, great work, just came across your solution, unfortunately also doesnt work with a forms library , can you post the code somewhere so i can see what the problem may be ? thanks

Reply

I tried with the records center - Drop Off Library. I don't see any issues in that. Make sure that the feature is activated at the record center site level. Give some more details on the error you get.

Reply

Thanks for the appreciation. Forms library issue is fixed in the Release 1.2.0.

Reply

Thanks for the appreciation. Metadata field issue is fixed in the Release 1.2.0.

Reply

Hi Rajesh,

can you please make available latest version in Codeplex, i didn't find any downloads for the latest version.
and thanks for the wonderful solution.

Thanks,
JK

Reply
Anonymous mod

Hi Rajesh,

great solution, but I have a problem - it doesn't work in IE8.
When I try to export I have a message "Web site not found".
What can be the metter?

Reply
Anonymous mod

Hi Rajesh,

The great solution for Sharepoint world. Can you please send me the source code of latest version, please? shilabhadra@live.in

Reply
Anonymous mod

Would you publish a SandBox version ? thx

Reply

It requires server side coding for response in excel format, so there is no sandbox version.

Reply
Anonymous mod

Hello Rajesh,

Is it also possible to select which list columns to export?

Thanks,

Jimmy

Reply
Anonymous mod

Is this possible only with Excel 2010? I have Office 2007 product only....
Also is this viewable to anonymous users? Your reply will be of much help
-Anu

Reply

Hi Anu, its not dependent on the version of office you use. You can use any version, the exported file is an excel file with an extension of .xls. About your query on anonymous users, I have never tried this but I don't see any issues with that. If possible I can give a try with that configuration also.

Reply
Anonymous mod

Thanks for your reply. I have not yet got a site with anonymous users enabled but I was trying to evaluate the possibilities in case if I implemented this.
The user should be able to only view the list and not have any other permission. Do you think he will still be able to access it?
I will let you know as soon as I get my hands on the site.
-Anu

Reply

For the users only with the view permissions, yes they will be able to access it.

Reply
Anonymous mod

Hi Rajesh

how can i export to excel my filter selected list in my sharepoint 2010, what will i do.

Reply

After applying the filter select all items and then click on export button in ribbon.

Reply
Anonymous mod

Hi Rajest

Is it possible to export a list, with more than 100 elements selected???

Reply

There is a limitation in SharePoint 2010 that you wont be able to select more than 100 items from any list.

Reply

Hi Jimmy,
It exports all the columns in that particular view, in your case you create a public or personal view with the select columns and then you can export to excel.

Reply

Hi Rajesh,

I am trying to add "Export to Excel" button in the listview webpart actions menu toolbar but not succeed. Could you please give me the suggestions how can i add your button code in the list view tool bar menu.

Reply

Hi Rajesh

Thanks for your solution...............

Could you please proved me that wsp solution file................

maheshk8703@g,ail.com
maheshkommu1986@gmail.com

Reply

Hi Rajesh,

The calculated column field value gets displayed as "float;#51.1139000000000" when the original value is "51.11" This is when the calculated column is created using columns that are of datatype "Number".

Reply

Thanks for sharing the info, will look into it.

Reply

Its fixed in http://gallery.technet.microsoft.com/SharePoint-2010-Export-ede385b9/file/97734/2/Rjesh.Solutions.wsp

Reply

Hi Rajesh,

I finished deploying your solution and it worked like magic for stand-alone forms and document libraries! However, it didn't work in my exact scenario where i create a webparts mashup to implement an inter-connected portal between multiple libraries - as suggested in this post http://msdn.microsoft.com/en-us/library/gg293116(v=office.14).aspx.

The "Export to Excel" button does not appear in the "Share and track" subcategory under the Document Tab. Any chance you could assist me bring this functionality to work in Webparts mashup?

I appreciate your efforts.


Thanks,

Anthony.

Reply
Anonymous mod

Your solution is awesome. It was working great until a few days ago. I can no longer export lists with lookup columns. Can it be affected by the User Profile Service being turned off?

Reply
Anonymous mod

You're awesome Rajesh. It would be awesome if you did guide on how to create this solution in Visual Studio.

Reply

The source code would save us from some reflection!

Reply
Anonymous mod

Hi, Rajesh.

Your App is the best one. I know you'll think I'm a little MAD, but I'd really like if you give me that code, because I'm trying to develop something similar, and It seems like this is a perfect code. Please, I need your help.
Please give me an answer as faster as you can, I'm in a hurry!!

Best regards,

Reply
Anonymous mod

Hello!

I hope you can help me. I have a custom list in SharePoint 2013. The list contains several items. What I wish to do, is that when a client visits my site, he can select the items he wishes to have and export only those items to a new list. It is like Export to Excel function already integrated into SP13 but the integrated function always exports the whole list.

I tried the solution you made for SP10(being optimistic) but it doesn't show in ribbon.

I hope you can help me and thank you in advance!

Reply
Anonymous mod

Hi Rajsh
Do you How Can I export selected items to excel in SharePoint 2013 list ?

Reply

I tried it once in my on premise environment, it worked. Its a farm solution so you can deploy it only on your on premise environment. Make sure that you activate the feature also post deployment.

Reply
Welch mod

Rajesh,

Thank you for all your hard work in developing this solution. I recently downloaded the v1.2.1 wsp. Deployed it to my SharePoint 2010 environment, then activated the feature. Works great when there are no lookup columns. However, when there are lookup columns, upon item selections and clicking the Export to Excel, I get a red box message with, "We regret for the inconvenience, some error has occurred. Please contact the administrator."

I remove the lookup columns and the export works just fine. Is there a fix for this? Is there something I need to change?

Thank you for your help.

- Welch

Reply

Hi Welch, sorry about the error. Exporting the look up column is one of the main test cases in my testing and I wonder why its failing in your case. Can you more details about the look up column in order to reproduce it at my end.

Reply
Welch mod

Thank you for responding. We are in dire need of this export solution and functionality so we got a membership with CloudShare so that we have a test environment to test the solution. The CloudShare VM environment is as follows:
Description: OS: Windows Server 2008 R2 x64 SP1
Spec: 80 GB HD / 8 GB RAM
Installed:
• SQL Server 2012 Business Intelligence Edition with PowerPivot, PowerView, SSRS (Native Mode and SharePoint Mode), SSAS (Multidimensional and Data Mining Mode, PowerPivot for SharePoint, Tabular Mode)
• Microsoft SQL Server 2012 PowerPivot for Microsoft Excel 2010
• Microsoft SQL Server 2012 Report Builder
• Microsoft SQL Server 2012 Performance Dashboard Reports
• Adventure Works for SQL Server 2012 Sample Databases
• Excel PowerPivot Sample Workbooks
• Visual studio 2010
• SharePoint Designer
• Office WebApps SP1
• Office 2010 Pro
• Visio 2010 Premium Edition
• Adobe Reader

I created a web application, a site collection, and site. Created a document library and a custom list in the site. Uploaded a couple documents to document library. Custom list would be used to let users add comments/reviews about specific documents in the document library. So there are two lookup columns in the custom list. One references the document library ID (thus providing link to document), and other field is the Title field. Both the document library and custom list allow for management of content types. Created two views, one that includes the lookup columns and one that has no lookup columns.

Downloaded and deployed your 1.2.1 Export to Excel WSP file. Activated the feature within the site. Export to excel works in view without lookup columns, and gives the "We regret for the inconvenience, some error has occurred. Please contact the administrator." in a red box when exporting to excel with lookup columns.

I hope that gives you a clearer picture of exactly what I did and hope you can help.

Thank you very much for your time and help.

- Welch

Reply
Anonymous mod

Hi. do you have sharepoint2013 version.. please could you add support for Publishing pages library
Thx
Marin

Reply

Post a Comment