0
votes

How to convert CSV raw source from GenerateFlowFile processor to Excel file using processor ExecuteStreamCommand or ExecuteScript

And how to run Python virtual env (env) to use dependencies in Python project?

enter image description here

1

1 Answers

0
votes

Wrap your CSV to Excel logic inside a Python script and call it using ExecuteStreamCommand. Start something like below and make changes as per your requirement -

import pandas as pd

  
  
# Reading the csv file content from NiFi
csv_df = pd.read_csv(sys.stdin)
  
# send excel file back to NiFi

csv_df.to_excel(sys.stdout.buffer, index = False)
  

Configure your ExecuteStreamCommand processor as -

enter image description here