public async Task LoadColumns() { await _columnsLoadControl.DoLoad(async() => { var sheetIndex = _sheetMeta.Index; var range = new ColumnHeaderRange(_sheetOptions); var columnNames = await Task.Run(() => XlsUtil.ReadColumnNames( _filePath, sheetIndex, range.FirstRowNumber, range.FirstColumnLetter, range.LastColumnLetter, range.HeaderRow)); _columnsControl.SetSourceColumns(columnNames); _columnsControl.SetTargetToNewTable(); }); }
private void Import() { XlsUtil.WithWorkbook(_filePath, workbook => { var sheet = workbook.GetSheetAt(GetSheetIndex(workbook)); var rows = XlsUtil.ReadSheet(sheet, _firstRowIndex, _lastRowIndex, _firstColumnIndex, _lastColumnIndex); SqlUtil.Import( srcColNames: XlsUtil.ReadColumnNames(rows, _headerRow), dataRows: rows.Skip(_headerRow ? 1 : 0), importTable: _stmt.ImportTable, temporaryTable: _temporaryTable, truncateExistingTable: _truncateExistingTable, ifConversionFails: _ifConversionFails, notebook: _notebook, runner: _runner, env: _env); }); }
private void Import() { XlsUtil.WithWorkbook(_filePath, workbook => { workbook.SeekToWorksheet(GetSheetIndex(workbook)); var rows = workbook.ReadSheet(_firstRowIndex, _lastRowIndex, _firstColumnIndex, _lastColumnIndex); SqlUtil.Import( srcColNames: XlsUtil.ReadColumnNames(rows, _headerRow), dataRows: rows.Skip(_headerRow ? 1 : 0), importTable: _stmt.ImportTable, temporaryTable: _temporaryTable, truncateExistingTable: _truncateExistingTable, stopAtFirstBlankRow: _stopAtFirstBlankRow, ifConversionFails: _ifConversionFails, blankValuesMethod: _blankValuesMethod, notebook: _notebook, runner: _runner, env: _env); }); }