'how can i create a sheet in a created excel workbook? [duplicate]

String tablaExcel = "Borrador-pantalla.xlsx";
        String rutaTablaExcel = "C:\\Users\\6001238\\Desktop\\"
                + tablaExcel;
        String hoja = "Hoja1";

        XSSFWorkbook libro = new XSSFWorkbook();
        XSSFSheet hoja1 = libro.createSheet(hoja);

I can not create a sheet in my created excel on java using apache poi eclipse



Solution 1:[1]

You have to use like this.

Workbook wb = new HSSFWorkbook(); 
OutputStream fileOut = new FileOutputStream("C:\\Users\\6001238\\Desktop\\yourFileName.xlsx"); 
Sheet sheet1 = wb.createSheet("YourSheetName"); 
--- Rest of the code ---

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sambit