Joe Webb

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

My 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 | Filed Under [ Reporting Services ]

Feedback

Gravatar

# 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
Gravatar

# 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
Gravatar

# 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
Gravatar

# 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
Gravatar

# 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
Gravatar

# re: Using Excel as a Reporting Services datasource

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

# 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
Gravatar

# 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
Gravatar

# 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
Gravatar

# 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
Gravatar

# 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
Gravatar

# 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
Gravatar

# re: Using Excel as a Reporting Services datasource

Hey,

u can use

SELECT *

FROM [Sheet1$] column1 <>""
7/10/2009 4:14 AM | ram
Gravatar

# re: Using Excel as a Reporting Services datasource

sorry i missed where clause

SELECT *

FROM [Sheet1$] where column1 <>""
7/10/2009 4:16 AM | ram
Gravatar

# Windward Reports Excels at this!....Get it? :)

Excel as a datasource is necessary for any reporting software in my opinion, not so much because large, complex sets of data should be stored in Excel but because they often are.

Having an Excel file delivered to you, and then having to transform it into XML is not only tedious but time consuming. Don't settle for this process by using Windward Reports which operates in Microsoft Word or Excel and can properly connect, implement and interpret data stored in an Excel format.
7/27/2009 6:19 PM | GrahamS
Gravatar

# re: Using Excel as a Reporting Services datasource


Getting error on using the query

SELECT *

FROM [Sheet1$] where column1 <>@Column1

An error occurred while executing the query.
ERROR [07002] [Microsoft][ODBC Excel Driver] Too few parameters. Expected 1. (Microsoft Report Designer)

===================================

ERROR [07002] [Microsoft][ODBC Excel Driver] Too few parameters. Expected 1. (odbcjt32.dll)
2/12/2010 5:12 AM | Navin
Gravatar

# re: Using Excel as a Reporting Services datasource

its called unnamed parameter use questionmark for paramter . I am not sure on multi value as its not owrking when i place it with in.

FROM [Sheet1$] where column1 <>?
2/12/2010 6:40 AM | Navin
Gravatar

# re: Using Excel as a Reporting Services datasource

Is it possible to JOIN on the data retrieved from the Excel Source with the data existing in the SQL Database and produce a report? Or is this feature not available?
2/23/2010 4:23 PM | Venkat
Gravatar

# re: Using Excel as a Reporting Services datasource

multi-parameter in a dataset is ok, but all parameter names become questionmark.
I would like to ask do you know how to

1) alias the parameter name
2) is seems IN clause can not work in this case, does anyone know how to use IN clause?
3) can we join several worksheets in a Excel, just like joining different table in database?
3/24/2010 10:16 PM | Simon
Gravatar

# re: Using Excel as a Reporting Services datasource

I have locking issues on the source excel sheet, and I need to be able to update the data and for the RS report to refresh. Is there any way of getting round this?
4/21/2010 8:59 PM | Chloe
Gravatar

# re: Using Excel as a Reporting Services datasource

You can use graphic reporting instead of images but there is no way to put images with vba
6/16/2010 12:25 AM | geld

Post Comment

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

Powered by:
Powered By Subtext Powered By ASP.NET