Friday 2 December 2016

How to use CSV file as Data Source in SSRS Report

How to use CSV file as Data Source in SSRS Report


SSRS report with CSV Data Source

  In one of our development scenario I got requirement to develop one functionality of SSRS report from CSV Data source, I did searched online but, didn’t get proper article with easy steps, then I thought to write this article for all developers who are searching for CSV as a SSRS report Data Source


  • Add new report, when you are creating data source select OLE DB Driver, and click Edit button.

  •          Select “Microsoft.Jet.OLEDB.4.0” driver and give only your file path, check Test Connection, after Succeeded hit ok, ok, Or copy paste this connection string            Provider=Microsoft.Jet.OLEDB.4.0;Data Source="U:\\SSRS CSV Source";Extended        Properties="text;HDR=YES;FMT=Delimited"
  •  Create Data Set and write your query as shown below, don’t keep space in between your file name   Select * from Fund_groups.csv  



  • You can also write Where conditional and filter CSV records, @Fund is report parameter,   SELECT  * FROM Fund_groups.csv  where Fund_Family in (@Fund)  This works in Query Designed

 But this won’t work in report execution, see below error message ,for multi value with where condition.
(It Does not support by Data extension)

  • Solution for this is, Filter records on Data set, remove (0) from parameter                                       Eg.  Parameters!Fund.Value(0) use only Parameters!Fund.Value SSRS takes multiple values internally

   
  • Now your report is ready, 


This way you can achieve csv as a data source,
we can also join 2 CSV files and use as data source for SSRS reports, please see this new article
"How to join two CSV files for SSRS reporting"

please leave your message, comments, feedback. Thank you!