Browse Source

feat(nc-gui): skip empty lines when parsing

pull/4135/head
Wing-Kam Wong 2 years ago
parent
commit
952a32c327
  1. 2
      packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts

2
packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts

@ -205,6 +205,7 @@ export default class CSVTemplateAdapter {
let steppers = 0 let steppers = 0
const tn = file.name.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim() const tn = file.name.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim()
parse(file.originFileObj as File, { parse(file.originFileObj as File, {
worker: true,
skipEmptyLines: 'greedy', skipEmptyLines: 'greedy',
step(row) { step(row) {
steppers += 1 steppers += 1
@ -256,6 +257,7 @@ export default class CSVTemplateAdapter {
if (this.config.importData) { if (this.config.importData) {
parse(file.originFileObj as File, { parse(file.originFileObj as File, {
worker: true, worker: true,
skipEmptyLines: 'greedy',
step(row) { step(row) {
steppers += 1 steppers += 1
if (row && steppers >= +that.config.firstRowAsHeaders + 1) { if (row && steppers >= +that.config.firstRowAsHeaders + 1) {

Loading…
Cancel
Save