Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Excel into Crystal (mulitple tabs)

Status
Not open for further replies.

aj3221

Technical User
May 14, 2008
79
US
I use this function a lot but have always wondered if it's possible to import an excel file with 2 different tabs to make them into 1. I have some data (.xls) that has two tabs. It's continuous data so I would like to bring in the 2nd tab and merge it w/ the 1st tab (like you can do in sql) but whenever I try to bring the 2nd tab in, it creates it like a whole new file and wants to find the joins between the spreadsheets. Is there a way to do this that you know of?
 
So, after looking up some info about how to create a command to pull from Excel. I created a simple Excel spreadsheet with two tabs and two columns (id and data). After dropping the first tab (Sheet1) into the report. I looked at the SQL query. Copied it. Removed the Sheet1 data from the report. Created a command and pasted the SQL query then did a union to connect my second tab. See example below.

SELECT `Sheet1_`.`id`, `Sheet1_`.`data`
FROM `Sheet1$` `Sheet1_`


union

SELECT `Sheet2_`.`id`, `Sheet2_`.`data`
FROM `Sheet2$` `Sheet2_`
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top