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
Did this help you find an answer to your question?

2 replies

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • 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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings