sheetjs/demos/database/SheetJSMongo.js
SheetJS 08bb7e6e60 version bump 0.12.7: chrome extension
- `writeFile` support chrome extension (fixes #1051 h/t @atkinsam)
- demo refresh
2018-03-29 00:31:36 -04:00

16 lines
387 B
JavaScript

/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
/* eslint-env node */
var XLSX = require("xlsx");
async function book_append_mongo(wb, coll, name) {
const aoo = await coll.find({}).toArray();
aoo.forEach((x) => delete x._id);
const ws = XLSX.utils.json_to_sheet(aoo);
XLSX.utils.book_append_sheet(wb, ws, name);
return ws;
}
module.exports = {
book_append_mongo
};