/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

/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

//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.........

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?
a property file in Java: "How to read properties file in Java?" ADS... 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
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... is the program to read a file in Java. import java.io.*; public class FileRead
How to pretty print a JSON file in Python?
How to pretty print a JSON file in Python? In this tutorial I will teach you to read the JSON file in Python and then pretty print the content... file with then you can use the program here to read and test the program
How To Read File In Java with BufferedReader
line; // 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
org.apache.myfaces.tobago - tobago-example-blank version 1.0.31 Maven dependency. How to use tobago-example-blank version 1.0.31 in pom.xml?
of tobago-example-blank in pom.xml? How to use tobago-example-blank version...-blank in project by the help of adding the dependency in the pom.xml file...; dependency? How to use  org.apache.myfaces.tobago - tobago-example-blank
org.apache.myfaces.tobago - tobago-example-blank version 2.4.5 Maven dependency. How to use tobago-example-blank version 2.4.5 in pom.xml?
of tobago-example-blank in pom.xml? How to use tobago-example-blank version 2.4.5...; dependency? How to use  org.apache.myfaces.tobago - tobago-example-blank version...-blank version 2.4.5 java library in your project. Now you can save the file
org.apache.myfaces.tobago - tobago-example-blank version 2.4.5 Maven dependency. How to use tobago-example-blank version 2.4.5 in pom.xml?
of tobago-example-blank in pom.xml? How to use tobago-example-blank version 2.4.5...; dependency? How to use  org.apache.myfaces.tobago - tobago-example-blank version...-blank version 2.4.5 java library in your project. Now you can save the file
org.apache.myfaces.tobago - tobago-example-blank version 1.0.37 Maven dependency. How to use tobago-example-blank version 1.0.37 in pom.xml?
of tobago-example-blank in pom.xml? How to use tobago-example-blank version...-blank in project by the help of adding the dependency in the pom.xml file...; dependency? How to use  org.apache.myfaces.tobago - tobago-example-blank
org.apache.myfaces.tobago - tobago-example-blank version 1.5.13 Maven dependency. How to use tobago-example-blank version 1.5.13 in pom.xml?
of tobago-example-blank in pom.xml? How to use tobago-example-blank version...-blank in project by the help of adding the dependency in the pom.xml file...; dependency? How to use  org.apache.myfaces.tobago - tobago-example-blank
org.apache.myfaces.tobago - tobago-example-blank version 4.1.0 Maven dependency. How to use tobago-example-blank version 4.1.0 in pom.xml?
of tobago-example-blank in pom.xml? How to use tobago-example-blank version 4.1.0...; dependency? How to use  org.apache.myfaces.tobago - tobago-example-blank version...-blank version 4.1.0 java library in your project. Now you can save the file
org.apache.myfaces.tobago - tobago-example-blank version 1.0.37 Maven dependency. How to use tobago-example-blank version 1.0.37 in pom.xml?
of tobago-example-blank in pom.xml? How to use tobago-example-blank version...-blank in project by the help of adding the dependency in the pom.xml file...; dependency? How to use  org.apache.myfaces.tobago - tobago-example-blank
how to read a text file with scanner in java
how to read a text file with scanner in java  Hi, I am looking... class. how to read a text file with scanner in java? Thanks   Hi... void main(String[] args) throws FileNotFoundException { // File to read
how to read file using InputStreamReader in java
how to read file using InputStreamReader in java  Hi, I want to learn to use the InputStreamReader class of Java and trying to read a text file with the class. how to read file using InputStreamReader in java? Thanks  
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..._TO_REPLACE_1 Example This example demonstrates that how to read a file in java
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
UItextfield blank
UItextfield blank  Hi, How I can check if UITextfield is blank and then display error to the user? ThanksADS_TO_REPLACE_1   Hi, Following code can be used to validate the user input in iPhone and iPad applications
How to read big file line by line in java?
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... { public static void main(String[] args) { try{ //Big file to read
How to read text file in Servlets
How to read text file in Servlets       This section illustrates you how to read text... of the file Here is the file message.properties which is going to be read through
How to read properties file in java
How to read properties file in java Description of Example:- In this example... is the video tutorial of: "How to read properties file in Java?" How we... read properties file;-ADS_TO_REPLACE_1 ResourceBundle. Properties Class
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. ADS_TO_REPLACE_1
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 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... { public static void main(String[] args) { File file = null; WordExtractor
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
can't read my xml file in java
can't read my xml file in java  i've a xml file like this : <...(); } the codes can't read the xml file bcz i want to append the whole xml in my gui..._COMMENT> //nothing ... in this row and my some java codes
can't read my xml file in java
can't read my xml file in java  i've a xml file like this : <...(); } the codes can't read the xml file bcz i want to append the whole xml in my gui..._COMMENT> //nothing ... in this row and my some java codes
can't read my xml file in java
can't read my xml file in java  i've a xml file like this : <...(); } the codes can't read the xml file bcz i want to append the whole xml in my gui..._COMMENT> //nothing ... in this row and my some java codes
can't read my xml file in java
can't read my xml file in java  i've a xml file like this : <...(); } the codes can't read the xml file bcz i want to append the whole xml in my gui..._COMMENT> //nothing ... in this row and my some java codes
can't read my xml file in java
can't read my xml file in java  i've a xml file like this : <...(); } the codes can't read the xml file bcz i want to append the whole xml in my gui..._COMMENT> //nothing ... in this row and my some java codes
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
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 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 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
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
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
can't read my xml file in java
can't read my xml file in java  i've a xml file like this : <...(); } the codes can't read the xml file bcz i want to append the whole xml in my gui..._COMMENT> //nothing ... in this row and my some java codes
Java Read CSV file
Java Read CSV file In this tutorial, you will learn how to read csv file. CSV... opened a file data.csv  and created a BufferedReader object to read.... Here is a csv file:ADS_TO_REPLACE_1 Example import java.io.*; import
how to print the content of file in 2d matrix having same dimension as given in file(n*m).
how to print the content of file in 2d matrix having same dimension as given in file(n*m).   here is code: import java.io.File; import...]*/); } System.out.println(); } }} here is .txt file: 1.0 3.1 2.1 3.4 2.4 2.0 4.6 5.1
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... a file read-only by using file.setReadOnly() method of File class. After using this method, you will not be able to write or edit into the fileHere
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
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
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
Problem to print from my properties file - Java Server Faces Questions
i try to print some messages from my properties file but when i execute.... titreAchat is a variable defined in my Messages.properties file. Here are the codes...Problem to print from my properties file  Hi, I am a new user
Problem to print from my properties file - Java Server Faces Questions
i try to print some messages from my properties file but when i execute.... titreAchat is a variable defined in my Messages.properties file. Here are the codes...Problem to print from my properties file  Hi, I am a new user
how to read text file with java 8 stream api
how to read text file with java 8 stream api  Hi, I want to use Java... code. how to read text file with java 8 stream api? Thanks   Hi... String fileName = "data.txt"; // Read file with streams and print
Creating Blank DOM Document
; This tutorial shows you how to create blank DOM document. JAXP... BuilderFactory to create DocumentBuilder class. Here is the video insturction "How... and child elements to the blank document. Saving the DOM tree to the disk file

Ads