Skip to main content
Solved

Retrieve value from CSV Column Header


nedwaterman
Contributor
Forum|alt.badge.img+9

Hello,

I need to retrieve the value of a column header in a CSV file. The column header contains the ID of a meter I need to use as an insert into a database. Unfortunately I can't use a filepathreader as the id filed isn't included.

 

Any idea how I might do this? I have attached a test file. The value I need to extract from the column header is the string after the undescore.

Best answer by ebygomm

If you read the csv without a field names line so your attributes are returned as col0 and col1, the first record will contain the value in col1 and you can use a string searcher with some regex to return the value.

View original
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Best Answer
  • March 18, 2020

If you read the csv without a field names line so your attributes are returned as col0 and col1, the first record will contain the value in col1 and you can use a string searcher with some regex to return the value.


nedwaterman
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • March 18, 2020

Brilliant - thank you!