2018-03-29 04:31:36 +00:00
|
|
|
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
|
|
/* eslint-env node */
|
|
|
|
var XLSX = require("xlsx");
|
2018-03-29 15:42:49 +00:00
|
|
|
|
2018-03-29 04:31:36 +00:00
|
|
|
async function book_append_mongo(wb, coll, name) {
|
2021-04-20 15:32:53 +00:00
|
|
|
const aoo = await coll.find({}, {projection:{_id:0}}).toArray();
|
2018-03-29 04:31:36 +00:00
|
|
|
const ws = XLSX.utils.json_to_sheet(aoo);
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, name);
|
|
|
|
return ws;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
book_append_mongo
|
2021-04-20 15:32:53 +00:00
|
|
|
};
|