Page 1 of 1

Reading data from differnet worksheets(tabs) in excel file

Posted: Sat Nov 15, 2008 7:40 pm
by pradkumar
Hi

I am required to read data from different worksheets (tab) in a excel file and write to a table. I tried to develop a DS job but its just reading data from first tab. The data type and number of columns are same in tabs

Could any one let me know how to accomplish this?

Thanks

Posted: Sat Nov 15, 2008 7:54 pm
by ray.wurlod
The ODBC table name should be the same as that of the "system table" whose metadata you imported (including the "$" character).

Posted: Sat Nov 15, 2008 11:24 pm
by pradkumar
Hi ray
Thanks for ur reply.
As you said the tabs got exported in the form of system tables with $.
This corresponds to only the tabs in File 1. I used a user defined query to read data from tabs and write to a table.
But what shall be done if there is a file2 with the three tabs. Its not possible to automate the process. Do i need to always import the metadata while the job is running. Is there any way to automate this?

Thanks

Posted: Sun Nov 16, 2008 8:11 am
by ray.wurlod
No, you can not make it dynamic. The table name can be a job parameter but this would only be useful if each table (worksheet) had the same metadata.

Posted: Mon Nov 17, 2008 2:17 pm
by pradkumar
Hi

The metadata in all the worksheets will be the same. The only issue is that the number of worksheets can be changed at any time by the Business user.
File1 can have 3 worksheets, File 2 can have 5 worksheets.
So i am looking whether this process can be automated in data stage so taht it picks up new worksheet autoamtically.

is there any way that we can read all the names of worksheets and store it in file in Data stage. Else do we need to use any scripting language for this?

Posted: Tue Nov 18, 2008 12:37 am
by ray.wurlod
Answer this yourself. When you set up a DSN does it refer to a workbook or to a worksheet?

If it refers to a workbook then what you propose is probably do-able, most easily with a Routine that calls SQLTables() - a BCI function.