Skip to content

Commit

Permalink
#24 init table list for Excel files only if there is more than 1 spre…
Browse files Browse the repository at this point in the history
…adsheet
  • Loading branch information
RandomFractals committed Jun 11, 2019
1 parent f13b184 commit 4e1c422
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/data.preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,10 @@ export class DataPreview {
let dataRows: Array<any> = [];
const dataSchema = null;
if (workbook.SheetNames.length > 0) {
// save sheet names for data preview selections
this._tableList = workbook.SheetNames;
if (workbook.SheetNames.length > 1) {
// save sheet names for table list UI display
this._tableList = workbook.SheetNames;
}

// determine spreadsheet to load
let sheetName = workbook.SheetNames[0];
Expand All @@ -438,7 +440,7 @@ export class DataPreview {

// create json data file for text data preview
let jsonFilePath: string = this._uri.fsPath.replace(this._fileExtension, '.json');
if (this._dataTable.length > 0) {
if (this._dataTable.length > 0 && this._tableList.length > 1) {
// append sheet name to generated json data file
jsonFilePath = jsonFilePath.replace('.json', `-${sheetName}.json`);
}
Expand Down

0 comments on commit 4e1c422

Please sign in to comment.