alberthaff / ngx-papaparse

Papa Parse wrapper for Angular
https://alberthaff.dk/projects/ngx-papaparse/docs/v8
MIT License
90 stars 19 forks source link

Preserve a leading zero #83

Closed weilies closed 2 years ago

weilies commented 3 years ago

I have an import file

code,from,to IMSF01,0700,2200

but after import (code below), i noticed the console log showing 'from' node is storing 700 (number) instead of 0700 (string)

this.papa.parse($event.srcElement.files[0], {
  header: true,
  dynamicTyping: true,
  skipEmptyLines: "greedy",
  worker: true,
  complete: (result, file) => {
      // BUG! imported 0700 became 700
    console.log(result);
    this.importData = result.data;
  }
})

Is there any any config i can turn on to preserve the leading zeros?

alberthaff commented 3 years ago

I suspect that dynamicTyping is the cause. Have you tried setting it to false?