I am fairly new to C# and I've been wrecking my head with a problem. I need to read one particular line/position from a CSV file (2nd line, 4th column), which ALWAYS hold the data I expect.
(If you're curious: this CSV file is a report and the first 3 lines are a header. The field in question holds a date)
Here is what I (sort of) started with after doing some research (and with my n00b C# skills):
dt = new DataTable();
string[] csvRows = System.IO.File.ReadAllLines(origFilePath);
dt.Columns.Add(csvRows[0]);
for (int x = 1; x < 2; x++)
{
dt.Rows.Add(csvRows[x]);
}
dt.Rows[0][0].ToString(); // must modify [0][0]
Thing is, the file can be quite big, so I don't think I need to read the entire file and setting it into a table object for then retrieving that value.
I'm sure there must be a better way?!
Can someone please advise? Thank you in advance for your help.
Regards, P.