Friday, February 13, 2009

Windows Small Business Server includes Windows SharePoint Services by setup by default. We use SharePoint daily at Microsoft to collaborate as a team. One of the greatest benefits seems to be sharing a spreadsheet or List of items. The beauty of SharePoint is multiple people can work on it at the same time. Unlike with Excel, if you put it on a share, only one person can open it in Read/Write to make changes, or if you’re e-mailing it around, knowing which version has all the information in it.

With a SharePoint List, multiple people can work on different sections of a spreadsheet, but this causes the problem of what if you want the power of Excel behind your data to do graphing, or calculations on that data? Well, you can build an Office Connection to download the latest data each time the spreadsheet is opened!

In the top right-hand corner of the sheet drop down the View box and choose Create View.

In the page that shows, choose a Datasheet View.

Give the view a friendly name so you can find it, for this demonstration let’s just call it “Datasheet View”, and click OK.

Feel free to scroll down and apply any filters to strip data out depending on the purpose of the spreadsheet you’re building.

Once you’re looking at your new Datasheet view, you want to go to Actions and then choose Task Pane. A task bar will open on the right (you can also use a little gray arrow on the right if you want).

click Query List With Excel, and Excel will automatically open

In Excel

Choose to Enable the Data Connections (as for security reasons they are typically blocked, but we trust our Internal SharePoint site, so it’s ok). Once you Enable the data connection, all that Data goodness from SharePoint comes flying into Excel, ready to be worked with. If you wanted a one time connection, you’re done and you can stop now. If you want to create a connection you can use over and over again, continue on.

If an Import Dialog shows, make sure it says New Workbook at the bottom

Let’s go and Export the Office Connection so we can use it over and over again

On the Data tab of the ribbon, click on Connections

On the Work Book Connections pop-up, you’ll see a randomly named connection, ensure it’s selected and click Properties

Give the connection a friendly name under Connection name as I have done above.

Select the Enable background refresh and Refresh data when opening the file.

After you’ve made these changes, switch to the Definition tab and at the bottom, click Export Connection File. Save this file with a well known name in a well known place. I use the Connection Name I defined earlier as the file name as well, then click OK.

Using the Saved Connection in a new Excel file

Now that you have the connection to SharePoint saved as an Office Connection, simply open a new or existing excel spreadsheet, and select the A1 cell (the headers will come in with the connection, straight out of SharePoint!

Click on the Data tab and click Existing Connections and then Browse for More … and navigate to the saved Office Connection.

On the Import Data select OK, and the Data from SharePoint just seamlessly Jumps into the Spreadsheet.

Now every time you open that Excel file, it will re-query the SharePoint site for the latest data. Updating data only in one place saves time and energy. You can program Excel to make calculations on the data, graph the data and show the data in different pivots as you see fit within Excel.

As a side note, my manager uses this remote data methodology to also download tables from the Internet for his fantasy baseball league to help him make his weekly picks! If anyone generates a spreadsheet as sophisticated as his, let me know….. No, I can’t give his out, because I don’t have it!

These steps are outlined for Excel 2007, I'm not sure if Excel 2003 can do this, but I believe it can. I'm sure it's called out clearly in Excel Help documentation. This was more of a heads up and "here's how to do it with the latest" steps. If you're interested in Excel 2003, I'm sure you can search the help for "data connections" and find something of use.

Great article, thanks. In your experience, would this work in a hosted environment? For example, if a client was using hosted sharepoint (ie an off-premises server) but had a local file server, would they be able to setup the same Excel data connection between the local Excel file and the hosted Sharepoint list?

I don't see why it wouldn't. Excel can grab all sorts of data from the web all over the place. I'd just make sure you're using a secure connection (SSL) to connect to the hosted solution, unless it's public data, like baseball stats. :oP