Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YOu dont need this lib anymore #59

Open
wandersonsousa opened this issue Dec 29, 2023 · 1 comment
Open

YOu dont need this lib anymore #59

wandersonsousa opened this issue Dec 29, 2023 · 1 comment

Comments

@wandersonsousa
Copy link

Just use the npm package xlsx, and:

import xlsx from "xlsx";

export function saveJsonToSheet(data, path) {
  console.log("building xlsx for data", data);
  const workbook = xlsx.utils.book_new();
  const worksheet = xlsx.utils.json_to_sheet(data);
  xlsx.utils.book_append_sheet(workbook, worksheet, "Sheet1");

  // Write xlsx data to a file (e.g., output.xlsx)
  xlsx.writeFile(workbook, path);
  console.log("xlsx file created successfully.");
}
@CmD0
Copy link

CmD0 commented Jun 18, 2024

This.

xlsx (the npm package for SheetsJS) is the main dependency for most newer json to xls libraries, just learn and use the xlsx workflow and you'll be good to do any and all operations you need to build and work with excel files in javascript/typescript

EDIT: json2xls broke recently due to a deep dependency releasing a breaking change, another reason to move to this way of doing things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants