Search code examples
javaexcelsmartxls

Change Sheet in Excelfile using SmartXls


I´m using SmartXLS for Java(5.7.1) to do some calculations in Excel.

Does anyone have experience with SmartXLS?

There are 5 worksheets in my file and I want to edit sheet 2. How am I able to select a specific sheet or how can I select a specific sheet and manipulate its contents?


Solution

  • So i found a way to solve my Problem.

    This way it works:

            for (int s = 0; s < getWorkBook().getNumSheets(); s++) {
            if (s == 1) {
                getWorkBook().setSheet(s);
                ... do some stuff ...
                }
            }
        }
    

    In this case (s == 1) represents sheet number 2.