Support Questions
Find answers, ask questions, and share your expertise

How to put csv file after modification in flowfile content

New Contributor
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);

        } as StreamCallback)
session.transfer(flowFile, ExecuteScript.REL_SUCCESS)
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.