Hi,
I try to automate the creation of png’s for my colleagues. The source data I get from an Ecxel.
My idea was as a first step to convert the excel data in a json file.
It seems the the usage of the npm package “xlsx” won’t work inside UXP. I understand that since I learned that UXP doesn’t support Node.js.
So my question is:
Is there an idea of how to convert programmatically xlsx to json? Are there other packages to use? Or maybe am I able to call a node.js function to do that convertion job outside UXP?
My code so far (assuming in this case that the xlsx file is within my plugin folder:
async function readXLSX(){
try {
const XLSX = require('./node_modules/xlsx/xlsx.js');
const fs = require("uxp").storage.localFileSystem;
const pluginFolder = await fs.getPluginFolder()
const theXLSXFile = await pluginFolder.getEntry("test.xlsx");
const workbook = XLSX.readFile(theXLSXFile);
} catch (e){
console.log("Error in function", e);
}
}
The result is “TypeError x.charCodeAt is not a function”.