sheetjs icon indicating copy to clipboard operation
sheetjs copied to clipboard

how to change the format of col from general to text so i can keep leading zeros in mobile number

Open ebra100 opened this issue 7 years ago • 2 comments

ebra100 avatar Dec 23 '18 11:12 ebra100

@SheetJSDev Do you have any solution to this? I get from excel for the number 90887 with format 0000000 (7 zeroes making it look like 0090887):

{
  s: {patternType: "none"},
  t: "n",
  v: 90887,
  w: "90887",
  z: "General"
}

using XLSX.read. If there were a field that could give me excel's custom format, that would probably fix it.

annaBTI avatar Nov 14 '19 20:11 annaBTI

Pass a string:

{ t: "s", v: "0090887" }

OR use a number format:

{ t: "n", v: 90887, z: "0000000" }

The z key is the number format that you would specify in Excel

SheetJSDev avatar Nov 14 '19 20:11 SheetJSDev