removeRow using XSSF libraries is not working

70
June 22, 2022, at 11:10 AM

I tried the below code, but it's not working

    File src = new File("E:\\TestData.xlsx");
    FileInputStream fs = new FileInputStream(src);
    XSSFWorkbook workbook = new XSSFWorkbook(fs);
    XSSFSheet sheet = workbook.getSheet("test");
    XSSFRow row = sheet.getRow(1);
    sheet.removeRow(row);

Note: Not getting any error also

Answer 1
You need to save file after row deletion
FileOutputStream outputStream = new FileOutputStream(File Path);
            workbook.write(outputStream);
            workbook.close();
            outputStream.close();
READ ALSO
WatchService watching files on distributed filesystem from multiple machines

WatchService watching files on distributed filesystem from multiple machines

I am trying to implement a WatchService that watches a filesystem for changesOnce files get created I want to create tasks for each new file and add that task to a distributed queue to let it get processed from multiple machines

36
Accessing local database from kubernetes cluster

Accessing local database from kubernetes cluster

I have a database running in local machine which i can access it using 1270

59
Handler in addValueEventListener running continuously

Handler in addValueEventListener running continuously

Im making a Uber clone app and whenever the driver receives a request he can accept it or decline it, but I want to add a feature where if the driver doesn't accept or decline the request within 8 second I want to decline it automatically

56
create SP in sybase and call it from java by passing List<XModel> to it

create SP in sybase and call it from java by passing List<XModel> to it

I have a pojo class XModeljava with fields -> f1, f2, f3, f4, f5, f6 all string and

64