sql query to select a specific cell in excel

user2539273 picture user2539273 · Aug 13, 2013 · Viewed 9.8k times · Source
Open_YYYY     Open_MM   MetricMonth     BaseTXN_Issued    AllTXN_Issued
2013            4        Apr-2013           24990                42179
2013            5        May-2013           37049                58037
2013            6        Jun-2013           33491                54869
2013            7        Jul-2013           34359                62047

I have the information above in an Excel file and I want to select and output just the value for the AllTXN_Issued for Jul-2013 as the total for last month's transactions. How do I do this in Java after connecting the Excel spreadsheet using jdbc-odbc connection?

Answer

Akram picture Akram · Oct 31, 2013

Try this, it works in all platforms.

Fillo fillo=new Fillo();
Connection connection=fillo.getConnection("C:\\Test.xlsx");
String strQuery="Select * from Sheet1 where ID=100";
Recordset recordset=connection.executeQuery(strQuery);

while(recordset.next()){
System.out.println(recordset.getField("Details"));
}

recordset.close();
connection.close();

http://www.codoid.com/products/view/2/29