代码如下:本地引入了jquery
<div id="ss"></div>
<div>
<input type="file" name="files[]" multiple id="import_excel_file" accept=".xlsx,.xls"/>
</div>
function excelImport() {
var spread = $("#ss").data("workbook");
spread.startSheetIndex(0);
spread.refresh();
var excelFile = $('#import_excel_file')[0].files[0]
var excelIo = new GC.Spread.Excel.IO();
excelIo.open(excelFile, function (json) {
var workbookObj = json;
spread.fromJSON(workbookObj);
}, function (e) {
console.log(e);
});
} |