public override void Execute() { Log.Info("Start to export excel to json..."); using (var reader = new ExcelOperation.ExcelReader(ExcelPath, ExcelTitleRow, ExcelContentRow)) { var sheets = new List<DataSheet>(); foreach (var sheetName in ExcelSheetNames) { Log.Info("Read sheet: {0}", sheetName); sheets.Add(reader.Read(sheetName)); } Log.Info("Write sheets to: {0}", JsonPath); File.WriteAllText(JsonPath, JsonOperation.SerializeSheets(sheets), Encoding.UTF8); } Log.Info("Done."); }
public override void Execute() { Log.Info("Start to export excel to json..."); using (var reader = new ExcelOperation.ExcelReader(ExcelPath, ExcelTitleRow, ExcelContentRow)) { var sheets = new List <DataSheet>(); foreach (var sheetName in ExcelSheetNames) { Log.Info("Read sheet: {0}", sheetName); sheets.Add(reader.Read(sheetName)); } Log.Info("Write sheets to: {0}", JsonPath); File.WriteAllText(JsonPath, JsonOperation.SerializeSheets(sheets), Encoding.UTF8); } Log.Info("Done."); }