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

Comments

  1. Anonymous1:58 AM

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

    ReplyDelete
    Replies
    1. Where can I download the source code from? I need to get this to work for Office 2013

      Delete
    2. https://github.com/rjesh-git/ExportSelectedItems

      Delete
  2. 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.

    ReplyDelete
  3. @ramanjulu, please share your email id.

    ReplyDelete
    Replies
    1. Hi Rajesh

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

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

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

      Delete
  4. 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"

    ReplyDelete
  5. @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.

    ReplyDelete
  6. Hi Rajesh,

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

    ReplyDelete
  7. 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.

    ReplyDelete
  8. @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

    ReplyDelete
  9. 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.

    ReplyDelete
  10. 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

    ReplyDelete
  11. Lisa Simmons7:03 AM

    @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?

    ReplyDelete
  12. @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.

    ReplyDelete
  13. 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

    ReplyDelete
  14. @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.

    ReplyDelete
  15. 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!

    ReplyDelete
  16. Roland Javet7:36 AM

    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

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

    ReplyDelete
  18. Roland2:09 AM

    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

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

      Delete
  19. Anonymous2:08 AM

    It doesn't work in record center site library

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

      Delete
    2. 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.

      Delete
  20. Anonymous7:41 PM

    Hi Rajesh!

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

    God Bless.

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

      Delete
  21. Anonymous7:30 AM

    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

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

      Delete
  22. 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

    ReplyDelete
  23. Anonymous6:43 AM

    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?

    ReplyDelete
  24. Anonymous5:12 AM

    Hi Rajesh,

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

    ReplyDelete
  25. Anonymous4:18 AM

    Would you publish a SandBox version ? thx

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

      Delete
  26. Anonymous10:04 AM

    Hello Rajesh,

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

    Thanks,

    Jimmy

    ReplyDelete
    Replies
    1. 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.

      Delete
  27. Anonymous7:14 AM

    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

    ReplyDelete
    Replies
    1. 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.

      Delete
    2. Anonymous1:21 PM

      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

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

      Delete
  28. Anonymous2:55 AM

    Hi Rajesh

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

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

      Delete
  29. Anonymous4:03 AM

    Hi Rajest

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

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

      Delete
  30. 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.

    ReplyDelete
  31. 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".

    ReplyDelete
    Replies
    1. Thanks for sharing the info, will look into it.

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

      Delete
  32. 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.

    ReplyDelete
  33. Anonymous7:12 PM

    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?

    ReplyDelete
  34. Anonymous8:07 AM

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

    ReplyDelete
  35. The source code would save us from some reflection!

    ReplyDelete
  36. Anonymous9:31 PM

    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,

    ReplyDelete
  37. Anonymous2:41 AM

    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!

    ReplyDelete
  38. Anonymous9:29 PM

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

    ReplyDelete
  39. 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.

    ReplyDelete
  40. Welch9:10 AM

    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

    ReplyDelete
    Replies
    1. 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.

      Delete
    2. Welch7:09 AM

      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

      Delete
  41. Anonymous2:56 AM

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

    ReplyDelete
  42. Anonymous1:39 AM

    Hello Rajesh

    I think its a nice Webpart but I have Problems to use it.
    The deployment is done without Errors and i can see the Icon in the ribbon.
    But when i select some files and click on the button i receive this message: "Unexpected response from the server. The status code of the response is '404'. The status text of the response is 'Not Found'."

    Is somthing wrong with the deployment?

    The Version is 1.2.1

    Many thanks for your answer
    Lg Eric

    ReplyDelete
  43. Anonymous7:53 AM

    Thank you for your post. Is there any way I can download the source code? I can only see the .wsp file to download.

    Thanks!!

    ReplyDelete
  44. Anonymous8:35 AM

    Thank you for your post. I do have a question. When exporting the items from the document library, the link to the document is not exported. It just exports the name of the document but not the link where we can click, which will open the document. Am I the only one having this issue or is the code supposed to work like that?

    ReplyDelete
  45. Anonymous12:27 PM

    Thanks for the post. Can you tell me if this only works for specific lists? Will it work with custom lists? I have installed it and on the lists that we have set up with custom columns and it doesn't seem to work but the out of the box list show the Export to Excel option.

    ReplyDelete
  46. Anonymous11:02 AM

    Thanks again. The solution uses .xls as the file format. Is there any way we can change it to .xlsx. I tried doing that but I could not do it successfully.

    ReplyDelete
  47. Anonymous10:43 PM

    hi.. this is what I want exactly but exporting all items is not possible her. can you share the source code to learn this. my id is sowmiya6262@gmail.com

    Thanks in Advance.

    ReplyDelete
  48. hii Rajesh,
    i m getting error while exporting selected Columns,
    "We regret for the inconvenience, some error has occured. Please contact the administrator."
    , the view contains 3--4 Lookup columns.
    what is the cause ?

    ReplyDelete
  49. Anonymous3:09 AM

    Hi Rajesh,

    Can you please help me how to download wsp file.

    ReplyDelete
  50. Anonymous6:41 AM

    Hi Rajesh,

    I've installed and activated the wsp file in SP 2013.
    When I select the items to export in a list and then click in the export button, I get the message:
    "We regret for the inconvenience, some error has occured. Please contact the administrator."

    Is it because I'm using SP 2013 instead of 2010? Is there a way to correct it?

    Thank you in advance!

    ReplyDelete

Post a Comment