Quick StartBy the sample: transforming an excel file into a csv file :
using System;
using System.Text;
using System.IO;
using ExcelSax;
namespace ExcelBySax {
class Program {
static void Main(string[] args) {
// ================================================================
// tests d'intégration de ExcelSax
// ----------------------------------------------------------------
try {
String fileName = args[0];
String sheetName = args[1];
Console.WriteLine("lecture de {0} {1}", fileName, sheetName);
DateTime t0 = DateTime.Now;
StringBuilder sb = new StringBuilder(5000);
using (StreamWriter sw = new StreamWriter("dest.csv")) {
using (ExcelSaxConnection esc = new ExcelSaxConnection(fileName)) {
foreach (ExcelSax.Sheet s in esc.Sheets) {
Console.WriteLine("{0}", s.Name);
}
using (ExcelSaxDataReader esdr = esc.GetReaderForSheet(sheetName)) {
while (esdr.Read()) {
sb.Clear();
foreach (var o in esdr) {
sb.AppendFormat("{0};", o);
}
sw.WriteLine(sb.ToString());
}
Console.WriteLine("bilan temps total {0}", DateTime.Now.Subtract(t0).TotalSeconds);
}
}
}
} catch (Exception ex) {
while (ex != null) {
Console.WriteLine(ex.Message);
ex = ex.InnerException;
}
}
}
}
}
MoreAbout ExcelSaxReader