Log in

View Full Version : Resolved Reading excel files and placing the data into a .csv file



kwood30
02-23-2018, 12:13 PM
Hi,

I am using c# and I am trying to read excel files, one row at a time, determining if the row is blank, a title or general data the returning it to a csv file. I have outlined code that I have been writing but I don't think I am quite there yet. I am also trying to check blank rows a number of times before finishing or/and throwing exceptions if incorrect data or empty file. I still think I have more to do, but if anyone can help, it would be appreciated.



Records = openExcelFile
List<csv> csv

Foreach (record in records)
{

rowType = ValiateRow(record);

switch (rowTYpe)
{
Case RowType.Header:
Continue;
Case RowType.Blank:
blankRows++;
if (blankRows > maxBLankRows)
return;
else
continue;
Case RowType.Valid:
CSV csv = ConvertTOCsv(record)
If (daf!= null)
Daff.add(csv);
Continue;
} // End switch

} // Foreach record

Deadweight
02-23-2018, 03:21 PM
(Admin) - Think this should belong in the 'Other' section. It is C# and not ASP. Can be wrong tho.