Splitting cell into strings in Excel - Apache POI JAVA
<p>I have an excel file that looks like this. Looking for a way to split col1 cells into separate parts (item in items).</p>

<pre><code>      col1     col2    col3    col4
      -----------------------------
row1 | 2,3,1    _        1      w
row2 | 3,2,7    _        2      x
row3 |   _      _        3      y
row4 |  4,9     _        4      z
</code></pre>

<p>CODE:</p>

<pre><code>import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;

public class Expy {
    public static void main(String[] args) {
        try {
        FileInputStream file = new FileInputStream(new File("C:\\Users\\...\\Bioactives25s.xlsx"));
        XSSFWorkbook workbook = new XSSFWorkbook(file);
        XSSFSheet worksheet = workbook.getSheetAt(0);
        for (int rowIndex = 0; rowIndex&lt;50000; rowIndex++){
           for (int columnIndex = 0; columnIndex&lt;30; columnIndex++){
            XSSFCell cell = worksheet.getRow(rowIndex).getCell(0);
            XSSFCell COL1 = worksheet.getRow(rowIndex).getCell(2);
            XSSFCell COL2 = worksheet.getRow(rowIndex).getCell(3);

            //important region
            String data = ??? ;
            String[] items = cell.split(",");
            //for (String item : items)

           if(cell != null){
           continue;}
            if(cell == COL1){
                System.out.print("it worked!!!");
            }
            if(cell == null){
                continue;
            }
</code></pre>

<p>I have no idea what to put in the question mark area. I tried putting in "file", I tried "worksheet", not sure what I'm supposed to write to make excel column 1 read as a string, so I can iterate over it. Very new to java. </p>

<p>Relevant: <a href="http://kodejava.org/how-do-i-split-a-string/" rel="nofollow">http://kodejava.org/how-do-i-split-a-string/</a></p>