mirror of
https://github.com/ljcoder2015/obsidian-excel.git
synced 2026-07-22 08:30:28 +00:00
fix: import excel file bug
This commit is contained in:
parent
5e98093f49
commit
8908dd9da4
1 changed files with 5 additions and 13 deletions
|
|
@ -51,7 +51,7 @@ export class ExcelView extends TextFileView {
|
|||
// console.log("saveData", this.data)
|
||||
this.save(false)
|
||||
.then(() => {
|
||||
// console.log("save data success", this.file)
|
||||
console.log("save data success", this.file)
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("save data error", e)
|
||||
|
|
@ -86,11 +86,12 @@ export class ExcelView extends TextFileView {
|
|||
}
|
||||
const f = files[0];
|
||||
const reader = new FileReader();
|
||||
const self = this
|
||||
reader.onload = (e) => {
|
||||
const data = e.target?.result;
|
||||
console.log('handleFile', this.file)
|
||||
console.log('handleFile', self.file)
|
||||
if (data) {
|
||||
this.process_wb(XLSX.read(data));
|
||||
self.process_wb(XLSX.read(data));
|
||||
} else {
|
||||
new Notice(t("READ_FILE_FAILED"));
|
||||
}
|
||||
|
|
@ -102,16 +103,7 @@ export class ExcelView extends TextFileView {
|
|||
const sheetData = stox(wb);
|
||||
if (sheetData) {
|
||||
this.sheet.loadData(sheetData)
|
||||
console.log("getdata", this.sheet.getData())
|
||||
this.data = this.headerData() + JSON.stringify(sheetData);
|
||||
// console.log("saveData process_wb", this.file)
|
||||
this.save(true)
|
||||
.then(() => {
|
||||
console.log("save data success")
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("save data error", e)
|
||||
})
|
||||
this.saveData(JSON.stringify(sheetData))
|
||||
} else {
|
||||
new Notice(t("DATA_PARSING_ERROR"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue