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

i am creating custom processor csv to json so here i am not able to convert flowfile into XSSFWorkbook .i have imported code also

Highlighted

i am creating custom processor csv to json so here i am not able to convert flowfile into XSSFWorkbook .i have imported code also

Explorer

if ( flowFile == null )

{ session.read(flowFile, new InputStreamCallback()

{

@Override public void process(InputStream in) throws IOException

{ // TODO Auto-generated method stub

try

{ DataFormatter formatter = new DataFormatter();

XSSFWorkbook workbook=new XSSFWorkbook(in);

XSSFSheet sheet=workbook.getSheetAt(0);

for (int i = 0; i <=sheet.getLastRowNum(); i++)

{

for (int j = 0; j < sheet.getRow(0).getLastCellNum(); j++)

{

obj.put(sheet.getRow(0).getCell(j).getReference(), formatter.formatCellValue(sheet.getRow(i).getCell(j)));

}

arr.add(obj);

} }

catch (JSONException e)

{

getLogger().error("Failed to read json string.");

} } });

// To write the results back out of flow file flowFile = session.write(flowFile, new OutputStreamCallback() { public void process(OutputStream out) throws IOException { // TODO Auto-generated method stub out.write(arr.toString().getBytes()); } }); }