I have to read all the cells of any column with header name "ABCD". I can get the values iterated over to any row but am stuck with a situation to get the column header name. I can also get the column header name using the excel as database: String sSQL = "Select * from [MAIN$]"; //sql statement Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DriverId=22;Dbq= " + XLSPath + ";ReadOnly=0;");
Statement stmnt = conn.createStatement();
rs = stmnt.executeQuery(sSQL); //sql statement
Statement stmnt1 = null;
//Connection conn1 = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DriverId=22;DBQ= " + XLSPath + ";ReadOnly=false;");
stmnt1 = conn.createStatement();
stmnt1 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String ctvstr = "Update [MAIN$] SET EXCEL_Heading=" + "'" + ColValues + "'" + " Where ID=" + j; stmnt1.executeUpdate(ctvstr);
I have to do the same thing in Java + xssf + poi