Để đọc dữ liệu bảng tính và sau đó chuyển đổi nó thành một mảng các đối tượng JSON, hãy chuyển tùy chọn
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6 khi gọi
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]7. Trong trường hợp đó, thay vì trả về một mảng các hàng ô, nó sẽ trả về một đối tượng có hình dạng
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]8 trong đó
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]9 sẽ là một mảng các đối tượng JSON được tạo từ dữ liệu bảng tính theo
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6 và
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]1 sẽ là một mảng gồm
Mỗi thuộc tính của một đối tượng JSON phải được mô tả bằng một "mục nhập" trong
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6. Khóa của mục nhập phải là tiêu đề của cột trong bảng tính. Giá trị của mục nhập phải là một đối tượng có thuộc tính
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
3 — Tên thuộc tính của đối tượngconst readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
4 — [tùy chọn] Thuộc tính bắt buộc có thể được đánh dấu làconst readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
5const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
6 — [tùy chọn] Chức năng xác thực giá trị ô. Chỉ được gọi trên các ô không trống. Nếu giá trị ô không hợp lệ, nó sẽ báo lỗi với thông báo lỗi được đặt thành mã lỗiconst readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
7 — [tùy chọn] Loại giá trị. Xác định cách giá trị ô sẽ được phân tích cú pháp. Nếu không cóconst readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
7 nào được chỉ định thì giá trị ô được trả về "nguyên trạng". dưới dạng chuỗi, số, ngày hoặc boolean. Mộtconst readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
7 có thể là một- Loại tích hợp
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
40import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
41import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
42import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
43
- Loại "Tiện ích" được xuất từ thư viện
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
44import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
45import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
46
- loại tùy chỉnh
- Hàm nhận giá trị ô và trả về giá trị được phân tích cú pháp. Nếu giá trị không hợp lệ, nó sẽ báo lỗi với thông báo lỗi được đặt thành mã lỗi
- Loại tích hợp
phụ lục. Theo mặc định, khi chuyển đổi các giá trị ô thành thuộc tính đối tượng, nó sẽ bỏ qua tất cả các giá trị
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]47 [bỏ qua tất cả các ô trống]. Đó là vì sự đơn giản. Tuy nhiên, trong một số trường hợp cạnh, có thể phải giữ tất cả các giá trị
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]47 cho tất cả các ô trống. Ví dụ: đó là trường hợp khi cập nhật dữ liệu trong cơ sở dữ liệu SQL từ bảng tính XLSX bằng cách sử dụng thư viện ORM Sequelize yêu cầu một thuộc tính rõ ràng là
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]47 để xóa nó trong một hoạt động
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]40. Để giữ tất cả các giá trị của
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]47, hãy chuyển tùy chọn
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]42 khi gọi
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]7
const readXlsxFile = require['read-excel-file/node']
// File path.
readXlsxFile['/path/to/file'].then[[rows] => {
// `rows` is an array of rows
// each row being an array of cells.
}]
// Readable Stream.
readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => {
// `rows` is an array of rows
// each row being an array of cells.
}]
// Buffer.
readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => {
// `rows` is an array of rows
// each row being an array of cells.
}]
1
Nếu có bất kỳ lỗi nào trong khi chuyển đổi dữ liệu bảng tính thành đối tượng JSON, thuộc tính
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]1 được trả về từ hàm sẽ là một mảng không trống. Một phần tử của thuộc tính
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]1 chứa các thuộc tính
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
47 — Mã lỗi. ví dụ.import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
48,import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
49- Nếu một hàm
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
40 tùy chỉnh được xác định và nó ném ra mộtimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
41 thì thuộc tínhimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
42 sẽ giống với giá trị củaimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
43 - Nếu một hàm
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
44 tùy chỉnh được xác định và nó đưa ra một giá trịimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
41 thì thuộc tínhimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
42 sẽ giống với giá trị củaimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
43
- Nếu một hàm
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
48 — Mã lỗi phụ tùy chọn cung cấp thêm chi tiết về lỗi. Hiện tại, nó chỉ được trả lại cho những chiếcconst readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
7 "tích hợp sẵn". Ví dụ.import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
40 choimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
41 có nghĩa là "giá trị ô không hợp lệ vì nó không phải là số"import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
42 — Số hàng trong tệp gốc.import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
43 có nghĩa là hàng đầu tiên, v.v.import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
44 — Tiêu đề cộtimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
45 — Giá trị ôimport readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
46 — Lược đồconst readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]
7 cho cột này
Một ví dụ về việc sử dụng một import readXlsxFile from 'read-excel-file'
// File.
const input = document.getElementById['input']
input.addEventListener['change', [] => {
readXlsxFile[input.files[0]].then[[rows] => {
// `rows` is an array of rows
// each row being an array of cells.
}]
}]
// Blob.
fetch['//example.com/spreadsheet.xlsx']
.then[response => response.blob[]]
.then[blob => readXlsxFile[blob]]
.then[[rows] => {
// `rows` is an array of rows
// each row being an array of cells.
}]
// ArrayBuffer.
// //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
//
// Could be obtained from:
// * File
// * Blob
// * Base64 string
//
readXlsxFile[arrayBuffer].then[[rows] => {
// `rows` is an array of rows
// each row being an array of cells.
}]
6
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]4Ví dụ về
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]7 tùy chỉnh
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]4Bỏ qua các hàng trống
Theo mặc định, nó bỏ qua mọi hàng trống. Để tắt hành vi đó, hãy vượt qua tùy chọn
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]60
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6Cách sửa dữ liệu bảng tính trước khi phân tích cú pháp
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6. Ví dụ: cách bỏ qua các hàng trống
Đôi khi, một bảng tính không có cấu trúc chính xác theo yêu cầu của tính năng phân tích cú pháp
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6 của thư viện này. ví dụ: nó có thể thiếu hàng tiêu đề hoặc chứa một số hàng hoàn toàn mang tính trình bày/trống/"rác" cần được xóa. Để khắc phục điều đó, người ta có thể chuyển một hàm
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]63 tùy chọn để sửa đổi nội dung bảng tính theo yêu cầu
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]1Chức năng chuyển đổi dữ liệu thành các đối tượng JSON bằng lược đồ cũng được xuất từ thư viện này, nếu có ai muốn
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]20Một thành phần React để hiển thị các lỗi xảy ra trong quá trình phân tích/xác thực lược đồ
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]21
JSON [ánh xạ]
Tương tự như trên, nhưng đơn giản hơn. mà không có bất kỳ phân tích cú pháp hoặc xác nhận
Đôi khi, nhà phát triển có thể muốn sử dụng một số giải pháp khác [nâng cao hơn] để phân tích cú pháp và xác thực lược đồ [như
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]64]. Nếu nhà phát triển chuyển tùy chọn
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]65 thay vì tùy chọn
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6 cho
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]7, thì nhà phát triển đó sẽ chỉ ánh xạ từng hàng dữ liệu tới đối tượng JSON mà không thực hiện bất kỳ phân tích cú pháp hoặc xác thực nào. Giá trị ô sẽ vẫn "như hiện trạng". dưới dạng chuỗi, số, ngày hoặc boolean
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]22
Nhiều trang tính
Theo mặc định, nó đọc trang đầu tiên trong tài liệu. Nếu bạn có nhiều trang tính trong bảng tính của mình thì hãy chuyển số trang tính [bắt đầu từ
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]43] hoặc tên trang tính trong đối số
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]69
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]23
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]24
Theo mặc định,
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]10 là
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]43
Để lấy tên của tất cả các trang tính, hãy sử dụng hàm
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]12
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]25
ngày
Định dạng XLSX ban đầu không có loại "ngày" chuyên dụng, do đó, trong hầu hết các trường hợp, ngày được lưu trữ đơn giản dưới dạng số [số ngày kể từ
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]13] cùng với mô tả "định dạng" [như
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]14] hướng dẫn phần mềm xem bảng tính định dạng
Khi sử dụng
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]15 với tham số
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6, tất cả các cột lược đồ có loại
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]43 sẽ tự động được phân tích thành ngày tháng. Khi sử dụng
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]15 mà không có tham số
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6, thư viện này sẽ cố đoán xem một ô có chứa ngày hay chỉ một số bằng cách kiểm tra "định dạng" của ô — nếu "định dạng" là một trong các định dạng ngày được tích hợp sẵn thì các giá trị của ô đó . Trong các trường hợp khác, khi các ô ngày tháng sử dụng định dạng không tích hợp sẵn [như
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]200], người ta có thể chuyển một tham số
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]201 rõ ràng để hướng dẫn thư viện phân tích các ô số có "định dạng" như ngày tháng
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]26
cắt tỉa
Theo mặc định, nó sẽ tự động cắt tất cả các giá trị chuỗi. Để tắt tính năng này, hãy vượt qua tùy chọn
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]202
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]27
Biến đổi
Đôi khi, một bảng tính không có cấu trúc chính xác theo yêu cầu của tính năng phân tích cú pháp
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]6 của thư viện này. ví dụ: nó có thể thiếu hàng tiêu đề hoặc chứa một số hàng hoàn toàn mang tính trình bày/trống/"rác" cần được xóa. Để khắc phục điều đó, người ta có thể chuyển một hàm
const readXlsxFile = require['read-excel-file/node'] // File path. readXlsxFile['/path/to/file'].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Readable Stream. readXlsxFile[fs.createReadStream['/path/to/file']].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // Buffer. readXlsxFile[Buffer.from[fs.readFileSync['/path/to/file']]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]63 tùy chọn để sửa đổi nội dung bảng tính theo yêu cầu
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]1
Hạn chế
Hiệu suất
Đã có một số báo cáo về vấn đề hiệu suất khi đọc bảng tính
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]1 rất lớn bằng thư viện này. Đúng là điểm chính của thư viện này là khả năng sử dụng và sự tiện lợi chứ không phải hiệu suất khi xử lý các bộ dữ liệu khổng lồ. Ví dụ: thời gian phân tích tệp có 2000 hàng/20 cột là khoảng 3 giây. Vì vậy, để đọc các bộ dữ liệu khổng lồ, có lẽ hãy sử dụng gói nào đó như gói
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]206. Không có tiêu chuẩn so sánh nào giữa hai tiêu chuẩn này, vì vậy nếu bạn định tạo một tiêu chuẩn, hãy chia sẻ tiêu chuẩn đó trong phần Vấn đề
công thức
Không hỗ trợ các ô được tính toán động bằng công thức [_______6207, v.v.]
bản đánh máy
Tôi không phải là chuyên gia về TypeScript, vì vậy cộng đồng phải viết các kiểu chữ [và kiểm tra chúng]. Xem ví dụ
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]208
CDN
Người ta có thể sử dụng bất kỳ dịch vụ CDN npm nào, e. g. giải nén. com hoặc jsdelivr. bọc lưới
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]29
bản đánh máy
Thư viện này đi kèm với TypeScript "types". Nếu bạn tình cờ tìm thấy bất kỳ lỗi nào trong đó, hãy tạo một vấn đề
Người giới thiệu
Sử dụng
import readXlsxFile from 'read-excel-file' // File. const input = document.getElementById['input'] input.addEventListener['change', [] => { readXlsxFile[input.files[0]].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] }] // Blob. fetch['//example.com/spreadsheet.xlsx'] .then[response => response.blob[]] .then[blob => readXlsxFile[blob]] .then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }] // ArrayBuffer. // //developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer // // Could be obtained from: // * File // * Blob // * Base64 string // readXlsxFile[arrayBuffer].then[[rows] => { // `rows` is an array of rows // each row being an array of cells. }]209 để phân tích cú pháp XML
GitHub
Vào ngày 9 tháng 3 năm 2020, GitHub, Inc. âm thầm cấm tài khoản của tôi [xóa tất cả các kho lưu trữ, các vấn đề và nhận xét của tôi, ngay cả trong các kho lưu trữ riêng tư của chủ nhân của tôi] mà không có bất kỳ thông báo hay lời giải thích nào. Do đó, tất cả các mã nguồn phải được chuyển ngay sang GitLab. Repo GitHub hiện chỉ được sử dụng làm bản sao lưu [bạn cũng có thể gắn dấu sao cho repo ở đó] và repo chính hiện là GitLab. Các vấn đề có thể được báo cáo trong bất kỳ repo nào