converting an Excel (xls) file to a comma separated (csv) file without the GUI

前端 未结 13 1799
走了就别回头了
走了就别回头了 2020-12-01 05:29

Is there a simple way to translate an XLS to a CSV formatted file without starting the Excel windowed application?

I need to process some Excel XLS workbooks with sc

13条回答
  •  粉色の甜心
    2020-12-01 06:24

    In Java world you can use apache poi. You could start from the following Groovy snippet.

    FileInputStream fis = new FileInputStream(filename);
    Workbook wb = new HSSFWorkbook(fis); 
    Sheet sheet = wb.getSheetAt(0);
    for (Row row : sheet) {
      for (Cell cell : row) {
        doSomething(cell.toString())
      }
    
    }
    

提交回复
热议问题