Joe Webb

Musing and observations about SQL Server, other technogies, and sometimes just life in general
posts - 85, comments - 291, trackbacks - 0

My Links

SQLTeam.com Links

News

This blog has moved!

Click here for the new location.

Follow me on Twitter
Add to Technorati Favorites

Search this Blog
 




Archives

Post Categories

About me

Using Excel as a Reporting Services datasource

While teaching a Microsoft SQL Server Reporting Services class in Charlotte, North Carolina, this week, one of the students asked to see an example of a report that uses a Microsoft Excel Spreadsheet as its datasource. Here are some screenshots from the demonstration.

The first step in using an Excel spreadsheet as a datasource is to create a System Data Source Name (DSN) for the spreadsheet. Open the ODBC Data Source Administrator from Control Panel | Administrative Tools.

SSRS_Excel1-2008-08-21

Add a new System DSN, providing a name in the Data Source Name box, and selecting the workbook that you wish to use for your report.

SSRS_Excel2-2008-08-21

Next, from within Business Intelligence Developers Studio (BIDS), create a new data source. Change the Type to ODBC. Click the Edit... button and select the DSN that you just created in the prior steps.

SSRS_Excel4-2008-08-21

To use the data from the spreadsheed in a report, create a new Dataset. For the query, type

SELECT *

FROM [Sheet1$]

Note that you can replace Sheet1 with the actual name of the worksheet tab in the Excel Workbook. The syntax requires that the name of the worksheet be followed by a dollar sign ($). As such, you must enclose the worksheet name in square brackets [] as shown below since a dollar sign is not considered a valid character in a select statement.

SSRS_Excel5-2008-08-21

Once we've created the Dataset, we can display it in a report like any other Dataset.

SSRS_Excel6-2008-08-21

Thanks Kim and Debbie for the question and for providing the fodder for this post.

Cheers!

Joe

kick it on DotNetKicks.com

Print | posted on Friday, August 22, 2008 4:46 PM

Feedback

# re: Using Excel as a Reporting Services datasource

Hello,
Is there any way that we can use an images as a data source.
This is the scenarion.
Daily I'm emailed a report that contains several charts.
I have a SSRS report deployed and I would like to create a lable that redirects to this image's path \\myserver\e$\myfolder\image
So next day I can overrite the image(updating it with new report) in that path and the SSRS report will refresh the content.

Am I crazy????
9/26/2008 2:59 PM | Virgilio

# re: Using Excel as a Reporting Services datasource

Images are really just pictures and don't have datasets from which to draw data. So, no, you cannot use images as a dataset.

On the otherhand, if you have access to the underlying datasat that made up the images, then sure.

HTH...

Joe
9/29/2008 7:16 AM | Joe Webb

# re: Using Excel as a Reporting Services datasource

Images are binary representations of the data. But unfortunately, they don't contain the data itself. So you cannot use an image as a datasource for your dataset.

If you have access to the original information, you can use.

HTH...

Joe
9/29/2008 7:19 AM | Joe Webb

# re: Using Excel as a Reporting Services datasource

Can one extract an image from an Excel document that is set up as a data source? In other words can I display in my report an image that is contained in the excel document?

Thanks
10/8/2008 2:29 AM | Theunis

# re: Using Excel as a Reporting Services datasource

I've been given the task of automating some forms with SSRS 2005 with data from an excel document. I have the data populating just fine, i have my dataset working, everything seems to be good. My problem is that i cannot figure out how to get parameters to work. I need to be able to set a start date and end date when the forms are run. It keeps telling me that i have too few parameters which means i'm calling the data wrong. What is the syntax for setting up parameters in the TSQL?

Thanks
10/27/2008 3:20 PM | Michael

# re: Using Excel as a Reporting Services datasource

Why not use filters?
10/28/2008 8:42 AM | Joe Webb

# re: Using Excel as a Reporting Services datasource

The form will be posted to our reporting server and the people who will actually be using it want to be able to set date ranges for the print outs, that way they aren't printing every record out.
10/28/2008 10:09 AM | Michael

# re: Using Excel as a Reporting Services datasource

Right, you can create a dataset based on the entire spreadsheet. Then use report parameters to prompt the user for what they'd like to see. And finally use a filter on the data region to limit the output based on their preferences. That would be more efficient.
10/28/2008 10:24 AM | Joe Webb

# re: Using Excel as a Reporting Services datasource

Ah right right, i was initially trying to filter from my dataset but i can definatly do it afterwards. Thanks!
10/28/2008 1:11 PM | Michael

# re: Using Excel as a Reporting Services datasource

Hi I did the above mentioned steps to create datasource connect to excel. But its not happending
My test connection is BIDS level are success but i could able to get the data from the sheet as well.

Please provide some way to connect it down
2/19/2009 4:59 AM | Rajasekaran

# re: Using Excel as a Reporting Services datasource

Hi all,

I am planning to use SQL reporting 2005 with MS excel 2007 as a datasource. Could you please let me know I should to use ODBC or OLE DB?. If anyone can give config details that will be a great help. Also once connected, can I use

SELECT *

FROM [Sheet1$]

command to get the data from excel ?. Please give me a reply. Thanks
4/17/2009 9:18 PM | Raj

# re: Using Excel as a Reporting Services datasource

I want to filter data from spreadsheet with WHERE in Select Query. I can select * from [spreadsheetname$] but want to add WHERE 'spreadsheet cell' <> 'blank' or empty. Cannot get the syntax correct. Any help?
5/27/2009 4:24 PM | Jane Woodhouse

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 3 and 2 and type the answer here:

Powered by: