read-excel-file
Version:
Read `.xlsx` files in a web browser or in Node.js
23 lines (22 loc) • 821 B
JavaScript
import xml from '../xml/xml.js';
import unpackXlsxFile from './unpackXlsxFileBrowser.js';
import parseSheet from './parseSheet.js';
/**
* Reads a single sheet from an `.xlsx` file.
* @param {(File|Blob|ArrayBuffer)} input
* @param {(number|string)} [sheet] — Sheet number or sheet name
* @param {object} [options]
* @return {Promise<SheetData>}
*/
export default function readSheet(input, sheet, options) {
// `sheet` argument is optional.
// It could be omitted while `options` argument is passed.
if (!options && sheet && typeof sheet !== 'number' && typeof sheet !== 'string') {
options = sheet;
sheet = undefined;
}
return unpackXlsxFile(input).then(function (contents) {
return parseSheet(contents, xml, sheet, options);
});
}
//# sourceMappingURL=readSheetWebWorker.js.map