Skip to content

Instantly share code, notes, and snippets.

@HussainArif12
Last active January 5, 2022 21:18
Show Gist options
  • Save HussainArif12/64da8cba6953ceb2772af5d9608cdc32 to your computer and use it in GitHub Desktop.
Save HussainArif12/64da8cba6953ceb2772af5d9608cdc32 to your computer and use it in GitHub Desktop.
const xlsx = require("xlsx");
const path = require("path");
const fileLocation = path.join(__dirname, "Expenses.xlsx");
const fileContents = xlsx.readFile(fileLocation);
const firstSheet = fileContents.SheetNames[0];
const sheetValues = fileContents.Sheets[firstSheet];
const parsedJSON = xlsx.utils.sheet_to_json(sheetValues);
function getParsedJSON() {
return parsedJSON;
}
console.log(getParsedJSON());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment