Difference between revisions of "ExcelSheet class"
Line 27: | Line 27: | ||
ExcelSheet es = new ExcelSheet(filename, isTemp); | ExcelSheet es = new ExcelSheet(filename, isTemp); | ||
string sheet1 = es.SheetNames.First(function(string a) { true; }); | string sheet1 = es.SheetNames.First(function(string a) { true; }); | ||
− | array headers = es.ToHeaders(); | + | array headers = es.ToHeaders(sheet1); |
array data = es.ToArray(sheet1, 1); | array data = es.ToArray(sheet1, 1); | ||
ImportManager im = new ImportManager(headers, data, ...); | ImportManager im = new ImportManager(headers, data, ...); | ||
Catglobe.File.Delete(filename, isTemp); | Catglobe.File.Delete(filename, isTemp); | ||
</source> | </source> |
Revision as of 04:51, 9 September 2016
ExcelSheet
An excel sheet
Constructors
- (string filename "Name of the file", bool isTemp "Is the file temporary") - Load a file from FileNamespace
Methods
- array ToArray(string sheetName "The sheet to convert", number fromrow "Skip number of rows") - Convert the sheet to an array of equal sized arrays
- array ToHeaders(string sheetName "The sheet to convert") - Convert the first row to array of strings
- string ToString() - The string representation of the object.
Properties
- string ObjectTypeName { get; } - The name of the type of object.
- array SheetNames { get; } - Get list of sheets in the excel file
- TypeInformation TypeInformation { get; } - Get information about this class.
Examples
string filename = "Upload2.xlsx";
bool isTemp = true;
ExcelSheet es = new ExcelSheet(filename, isTemp);
string sheet1 = es.SheetNames.First(function(string a) { true; });
array headers = es.ToHeaders(sheet1);
array data = es.ToArray(sheet1, 1);
ImportManager im = new ImportManager(headers, data, ...);
Catglobe.File.Delete(filename, isTemp);