I'm using sharepoint 2007, custom list. from the datasheet view I can export the list into excel/access file. is it possible to create a button that proposes to export the list to excel. (in order to alleviate on the end user)
3 Answers
I needed to do this for one of my projects. Here are the steps I took.
Generate an export for the data you want to share via the out of the box process (ie via the Action Menu). When prompted, name and save this file locally. This is the Excel Query File and it has information about the site, list and view that generates this data.
Place the file in the SharePoint site. I created a separate document library for this content. Make sure you set the appropriate permissions.
On the page, place the html that launches the query file. I placed it in an html link on a publishing page but this could also exist in a content editor webpart or a link list.
<a href="../filestorage/myExportFile.iqy">Export Data</a>
This was a 2007 site and used FBA for authentication. If you are using FBA, the 'Remember Me' checkbox must be checked on the sign in page for the query to work in Excel.
-
If I andertsood correct... the button link to predetermined excel file. and I need that the excel file will change dynamically. is it possible? am I do not understand somthing?– lironAug 29, 2011 at 12:30
-
Correct. The excel query file contains information about where and what data to retrieve from the site. So, yes, each time the file is open, it will go out to the site and get the latest data. I created a view on the list to get the data how I wanted it and then the Action | Export to Excel used this view for the query. Aug 29, 2011 at 13:07
The Actions menu of a Custom List has the "Export to Excel" button in. Are you after more than this offers? If so, what?
Bear in mind that the Export to Excel downloads an Excel Query File, which opens Excel, creates a Data Connection to the list and gets the data.
-
I whant to create button that link the user to excel file. in order to make this option more accessible. I know how to create a button, you can look at this article: webcache.googleusercontent.com/…. but I can not make the link to excel file with this button. thanks!– lironAug 28, 2011 at 12:09
Another way to do it is:
- Create a new Excel file
- Retrieve the data from the SharePoint list using Data > Web query
- Set the query to be refreshed when the file is opened
- Save the file in a SharePoint document library
- Create a button that opens the Excel file
This way, the query is inside the Excel file, which allows you to format the document and saves the end user a step.