Hi Everyone,
I have csv file where i give to an ExecuteScript that reads and modify some cells, the questions is how to set the csv back to the flowfile content .
here is my script. THANK YOU
flowFile = session.write(flowFile,
{ inputStream, outputStream ->
myAttr = flowFile.getAttribute('Mutations')
def slurped = new JsonSlurper().parseText(myAttr)
def builder = new JsonBuilder(slurped)
for (b in slurped){
part = b.cellname.split("(?<=\\D)(?=\\d)")
myrow = ((int)part[0]) - 66
mycol = part[1]
myvalue = b.value
Workbook wb = WorkbookFactory.create(inputStream);
Sheet sheet = wb.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
cell.setCellValue(8888);
}
outputStream.write(builder.toPrettyString().getBytes(StandardCharsets.UTF_8))
} as StreamCallback)
session.transfer(flowFile, ExecuteScript.REL_SUCCESS)