tech_memo
Excel操作 †
- JavaのApache POIを利用するのが楽
- POIライブラリ
- ソースサンプル
読み込みサンプル †
import org.apache.poi.xssf.usermodel.*
def filePath = "./test.xlsx"
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(filePath))
XSSFSheet sheet = workbook.getSheet("test");
for(i in sheet.getFirstRowNum()..sheet.getLastRowNum()) {
XSSFRow row = sheet.getRow(i)
XSSFCell idCell = row.getCell(0);
XSSFCell nameCell = row.getCell(1);
def id = idCell.getNumericCellValue() as int // ★Excelが数値を少数として認識していたので、整数に変換
def name = nameCell.getStringCellValue()
println "id = $id"
println "name = $name"
}
最新の20件
2023-01-26
2022-11-11
2022-03-02
2022-02-03
2021-11-18
2021-11-11
2021-10-27
2021-10-04
2021-09-30
2021-08-24
2021-04-01
2021-02-25
2020-08-13
2020-05-22
2020-04-16
2020-04-15
2020-03-23
2020-03-12
2020-02-27
今日の10件
- counter: 183
- today: 1
- yesterday: 0
- online: 1