0👍
You can convert the data to json and then read the result, like this:
created() {
var url = "/test.xlsx"
axios.get(url, {responseType:'arraybuffer'})
.then((res) => {
var data = new Uint8Array(res.data)
var wb = XLSX.read(data, {type:"array"})
const firstSheetName = wb.SheetNames[0]
const first_worksheet = wb.Sheets[firstSheetName]
// convert to json
const file_data = XLSX.utils.sheet_to_json(first_worksheet, { header: 1 });
// first column first row value
console.log(file_data[0][0])
})
.catch( err =>{this.err = err})
},
- [Vuejs]-For-in cicle gives back only last result in array.push
- [Vuejs]-Why Vue data is not updating int his case
Source:stackexchange.com