- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to convert Excel filed names to as our like column names in Apache nifi
- Labels:
-
Apache NiFi
Created ‎05-10-2023 10:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dears,
We have a small issue with excel sheet data loaded into DB table.
We are unable to load the data from excel in nifi if the field name have space or symbols.
ex: In excel field name is (Cost Center) , In DB (Cost Center) got error like column not matched.
if we send fileld name like Cost_Center then it is worked fine.
So, we request you that is there any possible in Nifi we can change (Cost Center (field name ) in excel to add(_) in that space to make it work?
ex:2 P&L item in excel field name also not work out because of & symbol.
Could you please suugest any approach for this if possible?
Created ‎05-11-2023 05:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@ushasri I believe the solution here is to use the Record based processors with a specified schema. This allows you to provide the correct schema to the Reader and the Writer regardless of the field names in original excel data source.
Created ‎05-11-2023 06:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry @steven-matison ,
I could n't Understand properly .
Request you to please elobrate on this.
My requirement is What ever the field name in excel, when it reach to nifi it should be like space between two words convert into _.
ex: in excel -- steven matison
to nifi -- steven_matison
because with space field names are not match with column names in db.
Created ‎05-11-2023 09:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dears,
Can you please suggest which record processor is exactly suitable for this scenario?
Thanks in Advance.
Created ‎05-12-2023 04:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are reading an Excel File, you can use an ConvertRecord processor, in which you define an Record Reader (CSVReader most likely) where you tell NiFi how to read the value (value separator). Next, with the help of a Record Writer (I assume CSV again or maybe Avro) you define how your data should look like, including the header. For both the Reader and the Writer you will have to define a schema, where you can do the replace of blank space with underline.
