File tree Expand file tree Collapse file tree 1 file changed +1
-10
lines changed
src/components/UploadExcel Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change @@ -82,8 +82,7 @@ export default {
82
82
const reader = new FileReader ()
83
83
reader .onload = e => {
84
84
const data = e .target .result
85
- const fixedData = this .fixData (data)
86
- const workbook = XLSX .read (btoa (fixedData), { type: ' base64' })
85
+ const workbook = XLSX .read (data, { type: ' array' })
87
86
const firstSheetName = workbook .SheetNames [0 ]
88
87
const worksheet = workbook .Sheets [firstSheetName]
89
88
const header = this .getHeaderRow (worksheet)
@@ -95,14 +94,6 @@ export default {
95
94
reader .readAsArrayBuffer (rawFile)
96
95
})
97
96
},
98
- fixData (data ) {
99
- let o = ' '
100
- let l = 0
101
- const w = 10240
102
- for (; l < data .byteLength / w; ++ l) o += String .fromCharCode .apply (null , new Uint8Array (data .slice (l * w, l * w + w)))
103
- o += String .fromCharCode .apply (null , new Uint8Array (data .slice (l * w)))
104
- return o
105
- },
106
97
getHeaderRow (sheet ) {
107
98
const headers = []
108
99
const range = XLSX .utils .decode_range (sheet[' !ref' ])
You can’t perform that action at this time.
0 commit comments