<?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 + Groovy + Apache POI for excel in outputStream in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Groovy-Apache-POI-for-excel-in-outputStream/m-p/359995#M238260</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/100754"&gt;@ollie_&lt;/a&gt;&amp;nbsp; did you find a solution ?&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2022 22:35:01 GMT</pubDate>
    <dc:creator>yamaga</dc:creator>
    <dc:date>2022-12-21T22:35:01Z</dc:date>
    <item>
      <title>Nifi + Groovy + Apache POI for excel in outputStream</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Groovy-Apache-POI-for-excel-in-outputStream/m-p/353620#M236759</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;i'm new to Nifi, and i try to understand how the in/out streams works in groovy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created one processor to generate flowfile, one to run a groovy script and a third one to putfile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried many many things but for now my groovy script (not working) look like this:&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;import org.apache.poi.ss.usermodel.*
import org.apache.poi.hssf.usermodel.*
import org.apache.poi.xssf.usermodel.*
import org.apache.poi.ss.util.*
import org.apache.poi.ss.usermodel.*
import org.apache.poi.hssf.extractor.*
import java.nio.charset.*
import java.io.*

def flowFile = session.get()

if(!flowFile) return

flowFile = session.write(flowFile, {inputStream, outputStream -&amp;gt;
    try {

FileOutputStream out = new FileOutputStream("workbook.xls");
outputStream.write(out);
out.close();
//is not working.

// def record = "toto"
// outputStream.write(record.getBytes(StandardCharsets.UTF_8))
//is working and giving me a txt file with toto in it.

    } catch(e) {
     log.error("Error during processing", e)
     session.transfer(flowFile, REL_FAILURE)
    }
} as StreamCallback)

session.transfer(flowFile, REL_SUCCESS)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;the error i get is :&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="errors2.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/35763i885D7091CF6E8887/image-size/large?v=v2&amp;amp;px=999" role="button" title="errors2.png" alt="errors2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;It says to me that the&amp;nbsp;ProcessSession.write(FlowFile) has not been closed.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;When i do outpustream.write of a string, it works, but with a excel file it doesn't work&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;At this point i really don't know what i'm missing.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My modules are well imported and class path had been setup.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I looked all over the internet but there is no ressource about writing an excel file in the output stream of nifi.&lt;/DIV&gt;&lt;DIV&gt;I 'm open to any other way to treat this problem.&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 29 Sep 2022 12:04:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Groovy-Apache-POI-for-excel-in-outputStream/m-p/353620#M236759</guid>
      <dc:creator>ollie_</dc:creator>
      <dc:date>2022-09-29T12:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi + Groovy + Apache POI for excel in outputStream</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Groovy-Apache-POI-for-excel-in-outputStream/m-p/359995#M238260</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/100754"&gt;@ollie_&lt;/a&gt;&amp;nbsp; did you find a solution ?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 22:35:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Groovy-Apache-POI-for-excel-in-outputStream/m-p/359995#M238260</guid>
      <dc:creator>yamaga</dc:creator>
      <dc:date>2022-12-21T22:35:01Z</dc:date>
    </item>
  </channel>
</rss>

