diff --git a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts index e8025c7199..0861c81e63 100644 --- a/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts +++ b/packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts @@ -29,6 +29,7 @@ export default class CSVTemplateAdapter { constructor(files: UploadFile[], parserConfig = {}) { this.config = { maxRowsToParse: 500, + autoSelectFieldTypes: true, firstRowAsHeaders: true, ...parserConfig, } @@ -224,11 +225,16 @@ export default class CSVTemplateAdapter { tn, [...Array((row.data as []).length)].map((_, i) => `column${i + 1}`), ) + if (that.config.autoSelectFieldTypes) { + // row.data is data + that.detectColumnType(tableIdx, row.data as []) + } + } + } else { + if (that.config.autoSelectFieldTypes) { // row.data is data that.detectColumnType(tableIdx, row.data as []) } - } else { - that.detectColumnType(tableIdx, row.data as []) } } },