I am developing a project for biometric attendance.I a have a thumb punching machine which exports daily reports in excel format for time in and time out of a staff.
report format:
Now I want to develop a C# application to read this file and show some reports on attendance.I tried converting this file to csv and used below code but output is blank.Any help will be thankful to guide as how to read this file (xls/csv)?
C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
try
{
var column1 = new List<string>();
var column2 = new List<string>();
using (var rd = new StreamReader("db.csv"))
{
while (!rd.EndOfStream)
{
var splits = rd.ReadLine().Split(';');
column1.Add(splits[0]);
column2.Add(splits[1]);
}
}
// print column1
Console.WriteLine("Column 1:");
foreach (var element in column1)
Console.WriteLine(element);
// print column2
Console.WriteLine("Column 2:");
foreach (var element in column2)
Console.WriteLine(element);
}
catch (Exception ae)
{
Console.WriteLine(ae);
}
finally
{
Console.WriteLine("ok");
}
}
}
}