Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process 17146- /here my file nameis sample.xls and this file contain some blanks cells how to read and how to print this blank cell as blank in console public ArrayList readCSV
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


hariprasad
/here my file nameis sample.xls and this file contain some blanks cells how to read and how to print this blank cell as blank in console public ArrayList readCSV
1 Answer(s)      3 years and 8 months ago
Posted in : Development process


//here my file nameis sample.xls and this file contain some blanks cells how to read and how to print this blank cell as blank in console

public ArrayList readCSV(File fileName) { ArrayList cellVectorHolder = new ArrayList(); try{

        FileInputStream myInput = new FileInputStream(fileName);
        POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);
        HSSFWorkbook myWorkBook = new HSSFWorkbook(myFileSystem);
        HSSFSheet mySheet = myWorkBook.getSheetAt(0);
       Iterator rowIter = mySheet.rowIterator(); 
       while(rowIter.hasNext())
       {

              HSSFRow myRow = (HSSFRow) rowIter.next();
              Iterator cellIter = myRow.cellIterator();
              ArrayList cellStoreVector=new ArrayList();
              String header_name = null;
              while(cellIter.hasNext())
              {

                      HSSFCell myCell = (HSSFCell) cellIter.next();
                      //if it is empty cell in  my excel file its not added to array ist 
                      cellStoreVector.add(myCell);

              }
              cellVectorHolder.add(cellStoreVector);
       }
}
catch (Exception e){e.printStackTrace(); }
return cellVectorHolder;

}

public void saveToDatabase(ArrayList array) {

for (int i=0;i<array.size(); i++)
{
    ArrayList cellStoreVector=(ArrayList)array.get(i);
    for (int j=0; j < cellStoreVector.size();j++)
    {
        HSSFCell myCell = (HSSFCell)cellStoreVector.get(j);
        String st = myCell.toString();
        System.out.println("values "+st);

    }
}

}

sir, the above code is my sample code for reading excel file and print values into console here i have a problem when reading blank cells and this blank cells are not displayed in the console. so please give me solution for reading blank cell and print this blank in console. thank you.........


Advertisement
View Answers

March 7, 2011 at 6:01 PM




Related Tutorials/Questions & Answers:
sir, how to read empty cell in excel file using poi and how to add this empty cell to arraay list and the following is my code
nameis sample.xls and this file contain some blanks cells how to read and how to print this blank cell as blank in console public ArrayList readCSV(File fileName... and print values into console here i have a problem when reading blank cells
How to design a blank CD, design a blank CD, blank CD
How to design a blank CD       This is a blank CD example, You will learn here how to make a blank CD by taking help of this example. New File: Take a new file with any
Advertisements
How to Read Excel file Using Java
How to Read Excel file In this section,you will learn how to read excel file... and every cell and stored the excel file values into the vector.This Vector data is then used to display file values on the console. Here is the code
How to read properties file in Java?
on console In this video tutorial I will show you how to use... to value. The java.util.Properties class is used to read the properties file... extensions. Here is example of property file: name=Rose India address=Rohini, Delhi
How to Read a File in Java
How to Read a File in Java? In this section we are going to know, How to read a file in Java. We have to follow three step to read a File. First get... can be very inefficient. Example Here is the program to read a file in Java
How To Read File In Java with BufferedReader
; // Read file line by line and print on the console while ((line...How To Read File In Java with BufferedReader class - example code This tutorial shows you how you can read file using BufferedReader class in your program
how to read this xml file - XML
how to read this xml file  i want to read this xml file using java... read i have tried lot more , but i am not able to read this xml file... name=client menu=client action=read user employee add
UItextfield blank
UItextfield blank  Hi, How I can check if UITextfield is blank and then display error to the user? Thanks   Hi, Following code can be used to validate the user input in iPhone and iPad applications. if([loginID.text
How To Read File In Java
How To Read File In Java In this section we will discuss about about how data of a file can be read in Java. A file can contain data as bytes, characters.... Example This example demonstrates that how to read a file in java. To read a file
MySQL Blank Field
MySQL Blank Field This example illustrates how to find Blank field by the MySQL Query. In the table 'example' two t_count fields are blank and we find both field which has some value by query 'select * from example where t_count
How to read big file line by line in java?
Learn how to write a program in java for reading big text file line by line In this tutorial I will explain you how you can read big file line by line... to read the big file in your java program. For example you have to process some
How to Read a file line by line using BufferedReader?
How to Read a file line by line using BufferedReader?  Hello Java... to me in my company. Here I have many big text files. I have to read these files... problem is to find the best way to read the file in Java. I just searched the google
How to read text file in Servlets
How to read text file in Servlets       This section illustrates you how to read text file in servlets. In this example we will use the input stream to read the text
how to read and write an xml file using java
how to read and write an xml file using java  Hi Can anyone help me how to read and write an xml file which has CData using java
Java Read CSV file
Java Read CSV file In this tutorial, you will learn how to read csv file. CSV.... Here is a csv file: Example import java.io.*; import java.util.*; public... opened a file data.csv  and created a BufferedReader object to read
How to read properties file in java
How to read properties file in java Description of Example:- In this example... read properties file;- ResourceBundle. Properties Class.  ... with the assigned key in the properties data file. How we will create .properties
How to read file in java
How to read file in java Java provides IO package to perform reading and writing operations with a file. In this section you will learn how to read a text... the given file name. read()-The read() method of FileInputStream class reads
how to read the .proprties file from struts - Struts
how to read the .proprties file from struts   errpr is :file not found exception:applicationresource.proprties file {system canot find file path"; How to set the file path.  Hi Friend, It seems that you haven't
How to read a line from a doc file
How to read a line from a doc file  How to read a line from a doc file   Hi Friend, To run the following code, you need to download POI... org.apache.poi.hwpf.extractor.WordExtractor; public class ReadDocFile { public static
How to read an eml file? - Java Beginners
How to read an eml file?  Hello dears, now i want to read en eml file stored in a folder. is it possible to use the same code for reading a txt file? or do i have to use javamail api? Thanks Spalax
How to read the .doc/ .docx file in Java Program
How to read the .doc/ .docx file in Java Program  Hi, I am beginner in Java programming language. Can anybody explain How to read .doc file in Java... to read the word document file. For doing this we will make class HWPFDocument which
How to make a file read-only
Description: This example demonstrate how to create a file and how to revoke... a file with specified name with read-only attribute. You can also check the the file properties, by default it is read-only
How to read excel2007 file - JSP-Servlet
How to read excel2007 file  Dear sir , I am able to read a excel 97-2003(.xls)files using apache poi.But for 2007(.xlsx)files to read... Friend, For reading .xls file you used HSSFWorkbook. but for .xlsx file reading
PHP Prevent blank upload
PHP Prevent blank upload  In my small PHP application, i am posting... is that it also accepts blank data as well as duplicate value. Is there any way to check and prevent it from posting the blank value? Thanks
How to read the contents in a file which is of input type file
How to read the contents in a file which is of input type file  I have a jsp page wherein i have to passs the file as input and read the contentsn... //In this servlet page i have tried to read the contents of a file in doPost method. I have used
how to read text file in jtable in netbeans7.0
how to read text file in jtable in netbeans7.0  text file... want to displaythe above .txt file in jtable as following format having 3... area which is design below table in netbeans IDE. how to do that ? pls help me
Creating Blank DOM Document
Creating Blank DOM Document       This tutorial shows you how to create blank DOM document. JAXP (Java...;} } In the next section I will show you how to add root and child elements to the blank
How to make a file read-only in java
How to make a file read-only in java A read-only file is any file...(); method is used. In the page you learned how to make a file read only... a file read-only by using file.setReadOnly() method of File class. After using
How to read password from the console
Description: Console class was introduced in jdk 1.6. This class help in taking the input from the console using its readPassword method . Here in this sample program it will ask to feed the password. Note it will accept the password
How to check if a file is read-only in java
How to check if a file is read-only in java A read-only file is any file... will not be able to make changes to it. You can make a file read-only by using... is in read only mode and you cannot modify it. Here is the code
How to check a file is read-able or not in java
Description: This example demonstrate how to check a file have read permission... check for its read property of a file. As in the file path we see '\' (backslash) that is used to denote file separation but here in this example
Advertisements
 

 

 

DMCA.com