java - How to access perticular data in excel sheet -
actually want fetch particular data excel sheet (.xls , .xlsx) have column name email in excel sheet , want fetch column. code wrote fetching details.sorry grammar.
package readfile;
import java.io.file; import jxl.cell; import jxl.sheet; import jxl.workbook; public class reademail { public static void main(string[] args) throws exception { file f=new file("c:\\users\\lqrp0023\\desktop\\try.xls"); workbook wb=workbook.getworkbook(f); sheet s=wb.getsheet(0); int row=s.getrows(); int col=s.getcolumns(); for(int i=0;i<row;i++) { for(int j=0;j<col;j++) { cell c=s.getcell(j,i); system.out.print(c.getcontents()); } system.out.println(""); // todo auto-generated method stub } }}
you want use cellreference utility class out.
you can like:
sheet sheet = workbook.getsheet("myinterestingsheet"); cellreference ref = new cellreference("b12"); row r = sheet.getrow(ref.getrow()); if (r != null) { cell c = r.getcell(ref.getcol()); }
that let find cell @ given excel-style reference
Comments
Post a Comment