Import Java. io. file; <br/> Import Java. io. fileinputstream; <br/> Import Java. io. filenotfoundexception; <br/> Import Java. io. ioexception; <br/> Import Java. text. simpledateformat; <br/> Import Java. util. date; </P> <p> Import Org. apache. poi. hssf. usermodel. hssfcell; <br/> Import Org. apache. poi. hssf. usermodel. hssfrow; <br/> Import Org. apache. poi. hssf. usermodel. hssfsheet; <br/> Import Org. apache. poi. hssf. usermodel. Hssfworkbook; </P> <p> public class importexcel {</P> <p> Public static void main (string [] ARGs) {<br/> string filepath = "E: // kemu.xls"; <br/> file myfile = new file (filepath); <br/> string stradd = ""; <br/> try {</P> <p> fileinputstream FD = new fileinputstream (myfile); <br/> hssfworkbook workbook; <br/> workbook = new hssfworkbook (FCM); <br/> hssfsheet sheet = NULL; <br/> hssfrow ROW = NULL; <br/> hssfcell Cell = NULL; <br/> simpledateformat sdf1 = new simpledateformat ("yyyymmdd"); <br/> string strprefix = sdf1.format (new date ()); <br/> If (workbook! = NULL) {<br/> Sheet = workbook. getsheetat (0); <br/>}< br/> If (sheet = NULL) {<br/> system. out. println ("You cannot import an empty Excel file! "); <Br/>}< br/> If (sheet! = NULL) {<br/> ROW = sheet. getrow (5); // read from the fifth line <br/>}< br/> for (Int J = 5; row! = NULL; j ++, row = sheet. getrow (j) {<br/> stradd = ""; <br/> for (INT Index = 1; index <= 10; index ++) {<br/> cell = row. getcell (short) (index-1); <br/> If (cell! = NULL) {<br/> If (cell. getcelltype () = hssfcell. cell_type_string) {<br/> stradd = cell. getstringcellvalue (); <br/>}< br/> else if (cell. getcelltype () = hssfcell. cell_type_numeric) {<br/> stradd = string. valueof (cell. getnumericcellvalue (); <br/>} else if (cell. getcelltype () = hssfcell. cell_type_blank) {<br/> stradd = ""; <br/>}</P> <p> system. out. println (stradd); <br/>}< br/>} catch (filenotfoundexception e) {<br/> E. printstacktrace (); <br/>}catch (ioexception IE) {<br/> IE. printstacktrace (); <br/>}</P> <p >}< br/>