feat: playground add submenu

This commit is contained in:
jialin
2024-11-22 10:00:34 +08:00
parent 22f90a505c
commit e05ec3d2d5
22 changed files with 1141 additions and 207 deletions
+16
View File
@@ -0,0 +1,16 @@
import XLSX from 'xlsx';
export default function readExcelContent(file: File): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = function (e: any) {
const arrayBuffer = e.target.result;
const workbook = XLSX.read(arrayBuffer, { type: 'string' });
const ws = workbook.Sheets[workbook.SheetNames[0]]; // get the first worksheet
const data = XLSX.utils.sheet_to_json(ws);
resolve(JSON.stringify(data));
};
reader.onerror = (error) => reject(error);
reader.readAsArrayBuffer(file);
});
}