Je souhaite lire l'objet requestPayLoad Json de certains fichiers my.xls et je souhaite également y écrire une réponse. Comment puis-je y aller? Je suis très nouveau à scala, donc Code spinet aidera.Gatling: - scala Lire l'objet JSON à partir du fichier Excel
Je parle de cette bibliothèque, mais il ne fonctionne pas
https://github.com/folone/poi.scala
J'écrit le code java comme ci-dessous, mais pas en mesure de simuler même code dans le scala
public class ExcelUtils {
private static Sheet excelWorkSheet;
private static Workbook excelWorkBook;
private static Cell cell;
public static void setExcelFile(String path, String sheetName) throws Exception {
InputStream excelFileInputStream = new FileInputStream(path);
String fileExtensionName = path.substring(path.indexOf("."));
if (fileExtensionName.equals(".xlsx")) {
excelWorkBook = new XSSFWorkbook(excelFileInputStream);
} else if(fileExtensionName.equals(".xls")) {
excelWorkBook = new HSSFWorkbook(excelFileInputStream);
}
excelWorkSheet = excelWorkBook.getSheet(sheetName);
}
public static String getCellData(int rowNum, int colNum) throws Exception {
cell = excelWorkSheet.getRow(rowNum).getCell(colNum);
String cellData = cell.getStringCellValue();
return cellData;
}
public static Sheet getExcelWorkSheet() throws IOException {
return excelWorkSheet;
}
}