Jaspersoft BI Tools

iReport,Jaspersoft Design Studio,Jaspersoft Server, Schema Workbench,Analysis,Dashboards, Self Service BI, Domains,Topics,Ad-Hoc Reports, Jaspersoft ETL, Embedding BI,HTML-5 charts, Fusion Charts,JFree Charts,Drill down reports , Drill down Dashboards,Visualize.js, Performance Tuning, D3 Charts, Jaspersoft Customization

Monday, May 06, 2013

Using Excel or CSV files as Data Source to Create Reports

It's a one year journey of using every time datasource type as "Database JDBC Connection"... On the way I just found a hut to take some rest and to have some fun. At the time my mind was thinking that why we have to go every time in a traditional way.. The moment I thought I was very eager to find some other alternative.. Today worked out on it.

I'm using : iReport Professional 5.0.0(Trail version) and Jasper Server CE(5.0.0).
Create an excell file before starting to work out this.
I've taken a sample data like

EMP_NO EMP_NAME DEPT_NO DEPT_LOC
100 SADAKAR 10 HYD
101 SHARAD 20 MYSORE
102 NAVEEN 10 HYD
103 GOPAL 20 BANGLORE
104 STELLA 10 HYD

Step 1 : Spreadsheet as datasource :
Click on datasource icon... Click on new .. select either of the options


i) Microsoft Excel(xls) data source (OR)[This is for older verisons of excell 98,2000 )
ii) Microsoft Excel 2007(xlsx) data source [This is for 2007.. didn't studied about 2010)
we are using 2007(xlsx) as our environment having 2007 excell software.
Find the picture below.


now click on Next
Step2:
It'll open anthoer window.
and give the details that has shown in it.


Name :sample_ xlsx2007
Excell file :C:\Users\helical002\Desktop\xlsx datasource.xlsx
click on Get Columns name from the first row of the file
You can see the list of column Name and Column Index as shown in the figure.
Step3:
* Right click on reportname in the report insepctor then click on Query Editor
* Click on Excell Datasource  tab
* Click on getfields from datasource
Click on OK.

Step 4:
Come back to the desing area of iReport.
Drag and drop the fields that you want to use.
Step5:
Save the file and and preview the output.
The final output looks something like this
We are done with the report.


NOTE: The same procedure we need to apply for CSV(Comma Separated Values) files to use as a datasource.


Thanks for reading this document.
Queries : sadakar.1988@gmail.com
:) :) :)

Your smile makes you more stronger...