Hi all,

I want to retrive all the sheets in a excel workbook. the following is the code i was written and this gives the table name along with some other values.


Connection con;
Statement st;
ResultSet rs,ps;
ResultSetMetaData rsmd;
DatabaseMetaData dbmd;

public void Connect_Excel(String WorkBookName,String list[])
{
con = null;
String Res_WBook_Name = "" ;
for(int i = 0; i < WorkBookName.length(); i++ )
{
if(WorkBookName.charAt(i)=='\\')
{
Res_WBook_Name = Res_WBook_Name + "\\\\";
}
else
{
Res_WBook_Name =Res_WBook_Name + WorkBookName.charAt(i);
}
}

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Driver={Mic rosoft Excel Driver (*.xls)};" +
"DBQ=" + Res_WBook_Name +
";DriverID=22;READONLY=false","","");

dbmd = con.getMetaData();
st = con.createStatement();


rs = dbmd.getTables(null, null, null, null);
int i=0;
while( rs.next())
{
System.out.println(rs.getString(3));
}

}catch(Exception ex)
{
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}




The input to this program is "Book1.xls". This workbook contain only 2 sheets named,

Msg-Inbox
Msg-Outbox.


and the actual output is ..

'Msg-Inbox$'
'Msg-Inbox$'_
'Msg-Inbox$'Z_59F1344A_26F2_42CC_88F6_3FDC53DADE60_#wvu #FilterDa
'Msg-Inbox$'Z_B2FA8073_FE79_46BA_9326_53C6CF8873E5_#wvu #FilterDa
'Msg-Outbox$'
'Msg-Outbox$'_
'Msg-Outbox$'Z_59F1344A_26F2_42CC_88F6_3FDC53DADE60_#wv u#FilterD
'Msg-Outbox$'Z_B2FA8073_FE79_46BA_9326_53C6CF8873E5_#wv u#FilterD


What does this means......
and how can i retrieve the table name along...

Please help meeee.


Thank u.