Katalon writing data to excel

I explained how you can do this in your other question on this topic. Start there. However, you need to move off the Manual tab onto the Script tab or you can “translate” what I put down from that question into the Manual tab. If this doesn’t fulfill your need, then we can give more information.

Edit: To make it even easier, I brought what I wrote there over to this question:

Maybe like this:

I need to read a client name between Test Suites, so I save the name from one Test Case of Suite 1 into another Test Case of Suite 2.

There may be newer ways to save between suites, but since it works, I don’t upgrade the code.

import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFWorkbook

gTestIdPathWay = "G:\\Katalon Test Cases\\Data Files\\TestId ST-07-CLM.xlsx";
gUserLastName = "WarmPerson01A1";

/* open connection to MS Excel, save surname to sheet 1, cell A2, close connection */
FileInputStream fis = new FileInputStream (gTestIdPathWay);
XSSFWorkbook workbook = new XSSFWorkbook (fis);

XSSFSheet sheet = workbook.getSheet("Sheet1");

// cell A2
Row row = sheet.createRow(1);
Cell cell = row.createCell(0);

cell.setCellType(cell.CELL_TYPE_STRING);
cell.setCellValue(gUserLastName);

FileOutputStream fos = new FileOutputStream(gTestIdPathWay);
workbook.write(fos);
fos.close();
fis.close();

and then to retrieve it:

import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFWorkbook

gTestIdPathWay = "G:\\Katalon Test Cases\\Data Files\\TestId ST-07-CLM.xlsx";

FileInputStream fis = new FileInputStream (gTestIdPathWay);
XSSFWorkbook workbook = new XSSFWorkbook (fis);

XSSFSheet sheet = workbook.getSheet("Sheet1");
// cell A2
Row row = sheet.getRow(1);
Cell cell = row.getCell(0);
gUserLastName= cell.getStringCellValue();

fis.close()