title: Reading excel cell value and storing the characters of the cell value into an array
body: <p>I am working on automating some excel task and need to compare two cells. the problem is that the cells I want to compare have different naming systems as the data comes from 2 different systems. For example, in one cell the value is <code>ETF AAAA:nyse 93473784793</code> and the value in another cell is <code>AAAA:nyse</code>. So if both cell contains the value <code>AAAA:nyse</code>, the cell is considered to be of same value. below is the code that has been written so far.</p>
  <pre><code>public class ExcelAuto {
      public static void main(String args[]) throws IOException {
          Scanner scannerFilePath = new Scanner(System.in);
          System.out.println(&quot;Please Enter File Path: &quot;);
          String excelFilePath = scannerFilePath.nextLine();
          FileInputStream inputStream = new FileInputStream(excelFilePath);
          XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
  
          Scanner scannerSheet = new Scanner(System.in);
          System.out.println(&quot;Please Enter Excel Sheet Name: &quot;);
          String excelSheetName = scannerSheet.nextLine();
          XSSFSheet sheet = workbook.getSheet(excelSheetName);
  
          DataFormatter df = new DataFormatter();
          for (int i = 0; i &lt; sheet.getLastRowNum() + 1; i++)
          {
              Cell cell = sheet.getRow(i).getCell(i+2);
              if (df.formatCellValue(cell).equals(df.formatCellValue(sheet.getRow(i).getCell(i+7)))) { //If cell is the same value as the one in the row below it
                  System.out.println(&quot;Equals&quot;);
              }
              else {//If cell has a different value as the one in the row below it
                  System.out.println(&quot;NOT Equals&quot;);
              }
          }
  
          //// using for loop
  
          int rows = sheet.getLastRowNum();
          int cols=sheet.getRow(0).getLastCellNum();
  
          for(int r=0; r&lt;=rows; r++){
  
              XSSFRow row=sheet.getRow(r);
  
              for(int c=0; c&lt;cols; c++){
  
                  XSSFCell cell=row.getCell(c);
                  switch(cell.getCellType()){
  
                      case STRING : System.out.print(cell.getStringCellValue());
                      System.out.print(&quot; | &quot;);
                      break;
  
                      case NUMERIC: System.out.print(cell.getNumericCellValue());
                      System.out.print(&quot; | &quot;);
                      break;
  
                      case BOOLEAN: System.out.print(cell.getBooleanCellValue());
                      System.out.print(&quot; | &quot;);
                      break;
  
  
                  }
  
              }
              System.out.println(&quot; | &quot;);
          }
      }
  }
  </code></pre>