<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Nifi Unable to convert CSV to Excel using POI API in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Unable-to-convert-CSV-to-Excel-using-POI-API/m-p/360495#M238411</link>
    <description>&lt;P&gt;I found a solution, this is my worked scripr:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-meta"&gt;@Grapes(@Grab(group='org.apache.poi', module='poi-ooxml', version='3.9'))&lt;/SPAN&gt;
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; com.opencsv.CSVReader
&lt;SPAN class="hljs-meta"&gt;@Grapes(@Grab(group='com.opencsv', module='opencsv', version='4.2'))&lt;/SPAN&gt;
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.xssf.streaming.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.hssf.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.xssf.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.util.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.hssf.extractor.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; java.nio.charset.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; java.io.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.commons.io.IOUtils

&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;flowFile&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; session.get()
&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;date&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;Date&lt;/SPAN&gt;()

&lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(!flowFile) &lt;SPAN class="hljs-type"&gt;return&lt;/SPAN&gt;


&lt;SPAN class="hljs-variable"&gt;flowFile&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; session.write(flowFile, {inputStream, outputStream -&amp;gt;
        &lt;SPAN class="hljs-type"&gt;SXSSFSheet&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;sheet1&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;CSVReader&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;reader&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;Workbook&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;wb&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;String&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;generatedXlsFilePath&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;"/home/"&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;FileOutputStream&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;fileOutputStream&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
  
  &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;filename&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; flowFile.getAttribute(&lt;SPAN class="hljs-string"&gt;'filename'&lt;/SPAN&gt;)
  &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;path&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; flowFile.getAttribute(&lt;SPAN class="hljs-string"&gt;'path'&lt;/SPAN&gt;)
  
            &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;nextLine&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;''&lt;/SPAN&gt;
            reader = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;CSVReader&lt;/SPAN&gt;(&lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;FileReader&lt;/SPAN&gt;(path+filename), &lt;SPAN class="hljs-string"&gt;','&lt;/SPAN&gt;);
 
 &lt;SPAN class="hljs-comment"&gt;//Workbook wb = WorkbookFactory.create(inputStream,);&lt;/SPAN&gt;
 &lt;SPAN class="hljs-comment"&gt;//Sheet sheet1 = wb.createSheet("Feuille");&lt;/SPAN&gt;
 
            wb = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;SXSSFWorkbook&lt;/SPAN&gt;(inputStream);
            sheet1 = (SXSSFSheet) wb.createSheet(&lt;SPAN class="hljs-string"&gt;'Sheet'&lt;/SPAN&gt;);
 
            &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;rowNum&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;;
            &lt;SPAN class="hljs-keyword"&gt;while&lt;/SPAN&gt;((nextLine = reader.readNext()) != &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;) {
                &lt;SPAN class="hljs-type"&gt;Row&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;currentRow&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; sheet1.createRow(rowNum++);
                &lt;SPAN class="hljs-keyword"&gt;for&lt;/SPAN&gt;(&lt;SPAN class="hljs-type"&gt;int&lt;/SPAN&gt; i=&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;; i &amp;lt; nextLine.length; i++) {
                    &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(NumberUtils.isDigits(nextLine[i])) {
                        currentRow.createCell(i).setCellValue(Integer.parseInt(nextLine[i]));
                    } &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (NumberUtils.isNumber(nextLine[i])) {
                        currentRow.createCell(i).setCellValue(Double.parseDouble(nextLine[i]));
                    } &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; {
                        currentRow.createCell(i).setCellValue(nextLine[i]);
                    }
                }
            }
  
 
            &lt;SPAN class="hljs-comment"&gt;//fileOutputStream = new FileOutputStream(generatedXlsFilePath.trim());&lt;/SPAN&gt;
            &lt;SPAN class="hljs-comment"&gt;//wb.write(fileOutputStream);&lt;/SPAN&gt;
            generatedXlsFilePath = generatedXlsFilePath + &lt;SPAN class="hljs-string"&gt;'SAISIE_MAGASING.XLS'&lt;/SPAN&gt;
            outputStream = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;FileOutputStream&lt;/SPAN&gt;(generatedXlsFilePath.trim());
 
            wb.write(outputStream);
            
                wb.close();
                &lt;SPAN class="hljs-comment"&gt;//fileOutputStream.close();&lt;/SPAN&gt;
                outputStream.close();
                reader.close();
                &lt;SPAN class="hljs-comment"&gt;//outputStream.close();&lt;/SPAN&gt;
                inputStream.close();
                
  
} as StreamCallback)



flowFile = session.putAttribute(flowFile, &lt;SPAN class="hljs-string"&gt;'filename'&lt;/SPAN&gt;, filename)&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Jan 2023 21:56:15 GMT</pubDate>
    <dc:creator>yamaga</dc:creator>
    <dc:date>2023-01-03T21:56:15Z</dc:date>
    <item>
      <title>Nifi Unable to convert CSV to Excel using POI API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Unable-to-convert-CSV-to-Excel-using-POI-API/m-p/360063#M238267</link>
      <description>&lt;P&gt;I want to convert csv flowfile content into XLS file usin groovy script + POI API&lt;/P&gt;&lt;P&gt;I m using ivy to grab POI dependencies and it seems work well.&lt;/P&gt;&lt;P&gt;please find more details below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my Nifi flow:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a9wjm.png" style="width: 404px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36526i4EE660D447B62974/image-size/large?v=v2&amp;amp;px=999" role="button" title="a9wjm.png" alt="a9wjm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my script&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-meta"&gt;@Grapes(@Grab(group='org.apache.poi', module='poi-ooxml', version='3.9'))&lt;/SPAN&gt;
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.hssf.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.xssf.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.util.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.hssf.extractor.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; java.nio.charset.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; java.io.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.commons.io.IOUtils

&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;flowFile&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; session.get()
&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;date&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;Date&lt;/SPAN&gt;()

&lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(!flowFile) &lt;SPAN class="hljs-type"&gt;return&lt;/SPAN&gt;

&lt;SPAN class="hljs-variable"&gt;flowFile&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; session.write(flowFile, {inputStream, outputStream -&amp;gt;
&lt;SPAN class="hljs-keyword"&gt;try&lt;/SPAN&gt; {
    
&lt;SPAN class="hljs-type"&gt;Workbook&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;wb&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; WorkbookFactory.create(inputStream,);
&lt;SPAN class="hljs-type"&gt;Sheet&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;mySheet&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; wb.getSheetAt(&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;);


&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;record&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; IOUtils.toString(inputStream, StandardCharsets.UTF_8)
outputStream.write(record.getBytes(StandardCharsets.UTF_8))

wb.close();

} &lt;SPAN class="hljs-keyword"&gt;catch&lt;/SPAN&gt;(e) {
 log.error(&lt;SPAN class="hljs-string"&gt;"Error during processing"&lt;/SPAN&gt;, e)
 session.transfer(flowFile, REL_FAILURE)
}
} as StreamCallback)


&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;filename&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; flowFile.getAttribute(&lt;SPAN class="hljs-string"&gt;'filename'&lt;/SPAN&gt;)+&lt;SPAN class="hljs-string"&gt;'.xlsx'&lt;/SPAN&gt;
flowFile = session.putAttribute(flowFile, &lt;SPAN class="hljs-string"&gt;'filename'&lt;/SPAN&gt;, filename) 

session.transfer(flowFile, REL_SUCCESS)&lt;/PRE&gt;&lt;P&gt;I get this error&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yamaga_0-1671751139553.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36528iEEA9909D74535A53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yamaga_0-1671751139553.png" alt="yamaga_0-1671751139553.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea about this error ?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 23:19:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Unable-to-convert-CSV-to-Excel-using-POI-API/m-p/360063#M238267</guid>
      <dc:creator>yamaga</dc:creator>
      <dc:date>2022-12-22T23:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi Unable to convert CSV to Excel using POI API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Unable-to-convert-CSV-to-Excel-using-POI-API/m-p/360495#M238411</link>
      <description>&lt;P&gt;I found a solution, this is my worked scripr:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-meta"&gt;@Grapes(@Grab(group='org.apache.poi', module='poi-ooxml', version='3.9'))&lt;/SPAN&gt;
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; com.opencsv.CSVReader
&lt;SPAN class="hljs-meta"&gt;@Grapes(@Grab(group='com.opencsv', module='opencsv', version='4.2'))&lt;/SPAN&gt;
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.xssf.streaming.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.hssf.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.xssf.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.util.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.ss.usermodel.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.poi.hssf.extractor.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; java.nio.charset.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; java.io.*
&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; org.apache.commons.io.IOUtils

&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;flowFile&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; session.get()
&lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;date&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;Date&lt;/SPAN&gt;()

&lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(!flowFile) &lt;SPAN class="hljs-type"&gt;return&lt;/SPAN&gt;


&lt;SPAN class="hljs-variable"&gt;flowFile&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; session.write(flowFile, {inputStream, outputStream -&amp;gt;
        &lt;SPAN class="hljs-type"&gt;SXSSFSheet&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;sheet1&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;CSVReader&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;reader&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;Workbook&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;wb&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;String&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;generatedXlsFilePath&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;"/home/"&lt;/SPAN&gt;;
        &lt;SPAN class="hljs-type"&gt;FileOutputStream&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;fileOutputStream&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;;
  
  &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;filename&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; flowFile.getAttribute(&lt;SPAN class="hljs-string"&gt;'filename'&lt;/SPAN&gt;)
  &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;path&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; flowFile.getAttribute(&lt;SPAN class="hljs-string"&gt;'path'&lt;/SPAN&gt;)
  
            &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;nextLine&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-string"&gt;''&lt;/SPAN&gt;
            reader = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;CSVReader&lt;/SPAN&gt;(&lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;FileReader&lt;/SPAN&gt;(path+filename), &lt;SPAN class="hljs-string"&gt;','&lt;/SPAN&gt;);
 
 &lt;SPAN class="hljs-comment"&gt;//Workbook wb = WorkbookFactory.create(inputStream,);&lt;/SPAN&gt;
 &lt;SPAN class="hljs-comment"&gt;//Sheet sheet1 = wb.createSheet("Feuille");&lt;/SPAN&gt;
 
            wb = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;SXSSFWorkbook&lt;/SPAN&gt;(inputStream);
            sheet1 = (SXSSFSheet) wb.createSheet(&lt;SPAN class="hljs-string"&gt;'Sheet'&lt;/SPAN&gt;);
 
            &lt;SPAN class="hljs-type"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;rowNum&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;;
            &lt;SPAN class="hljs-keyword"&gt;while&lt;/SPAN&gt;((nextLine = reader.readNext()) != &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;) {
                &lt;SPAN class="hljs-type"&gt;Row&lt;/SPAN&gt; &lt;SPAN class="hljs-variable"&gt;currentRow&lt;/SPAN&gt; &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; sheet1.createRow(rowNum++);
                &lt;SPAN class="hljs-keyword"&gt;for&lt;/SPAN&gt;(&lt;SPAN class="hljs-type"&gt;int&lt;/SPAN&gt; i=&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;; i &amp;lt; nextLine.length; i++) {
                    &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(NumberUtils.isDigits(nextLine[i])) {
                        currentRow.createCell(i).setCellValue(Integer.parseInt(nextLine[i]));
                    } &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (NumberUtils.isNumber(nextLine[i])) {
                        currentRow.createCell(i).setCellValue(Double.parseDouble(nextLine[i]));
                    } &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; {
                        currentRow.createCell(i).setCellValue(nextLine[i]);
                    }
                }
            }
  
 
            &lt;SPAN class="hljs-comment"&gt;//fileOutputStream = new FileOutputStream(generatedXlsFilePath.trim());&lt;/SPAN&gt;
            &lt;SPAN class="hljs-comment"&gt;//wb.write(fileOutputStream);&lt;/SPAN&gt;
            generatedXlsFilePath = generatedXlsFilePath + &lt;SPAN class="hljs-string"&gt;'SAISIE_MAGASING.XLS'&lt;/SPAN&gt;
            outputStream = &lt;SPAN class="hljs-keyword"&gt;new&lt;/SPAN&gt; &lt;SPAN class="hljs-title class_"&gt;FileOutputStream&lt;/SPAN&gt;(generatedXlsFilePath.trim());
 
            wb.write(outputStream);
            
                wb.close();
                &lt;SPAN class="hljs-comment"&gt;//fileOutputStream.close();&lt;/SPAN&gt;
                outputStream.close();
                reader.close();
                &lt;SPAN class="hljs-comment"&gt;//outputStream.close();&lt;/SPAN&gt;
                inputStream.close();
                
  
} as StreamCallback)



flowFile = session.putAttribute(flowFile, &lt;SPAN class="hljs-string"&gt;'filename'&lt;/SPAN&gt;, filename)&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Jan 2023 21:56:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Unable-to-convert-CSV-to-Excel-using-POI-API/m-p/360495#M238411</guid>
      <dc:creator>yamaga</dc:creator>
      <dc:date>2023-01-03T21:56:15Z</dc:date>
    </item>
  </channel>
</rss>

