I want to download all the information stored in my database (Firebase) into an Excel sheet through my API.
Right now I have +2000 rows of information and it works fine. I understand that now excel's limitations are beyond 65000 rows but just in case to avoid any inconvenience later on. How can I divide all my information into a second spreadsheet if I have more than 65000 chunks of info?
This is the library I'm using https://www.npmjs.com/package/xlsx
And here is my code:
downloadPlans() {
var wb = XLSX.utils.book_new();
wb.SheetNames.push("Plans");
var ws_data = [
[
"name",
"productType",
"onCreated",
"tags",
"catalog",
"state",
"brand",
"code",
"sqf",
"width",
"depth",
"category",
"stories",
"bedrooms",
"fullBaths",
"halfBaths",
"garage",
"garageLocation",
"garageType",
"garageBays",
"bedroomLocation",
"laundryLocation",
"description",
"region",
],
...this.planCategory.map((plan) => [
plan.name,
plan.productType,
plan.onCreated,
plan.tags.join(","),
plan.catalog,
plan.state,
plan.brand,
plan.code,
plan.sqf,
plan.width,
plan.depth,
plan.category,
plan.stories,
plan.bedrooms,
plan.fullBaths,
plan.halfBaths,
plan.garage,
plan.garageLocation,
plan.garageType,
plan.garageBays,
plan.bedroomLocation,
plan.laundryLocation,
plan.description,
plan.region,
]),
];
var ws = XLSX.utils.aoa_to_sheet(ws_data);
wb.Sheets["Plans"] = ws;
var wbout = XLSX.write(wb, {
bookType: "xlsx",
type: "binary",
});
function s2ab(s: string) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i < s.length; i++) view[i] = s.charCodeAt(i) & 0xff;
return buf;
}
FileSaver.saveAs(
new Blob([s2ab(wbout)], { type: "application/octet-stream" }),
"Plans.xlsx"
);
},