It seems that Wix supports “json-as-xlsx” npm module since I could just use it and not ask to request. But when I tried using it, it ends in an error. And I have this code inside one of the onClick button handlers.
In preview mode, it gives “cannot save file” error message. I was expecting the browser to prompt me a “Save” dialog to save this file. I guess Wix doesn’t support this npm module? Or am I not using the right options for it to work in Wix? Any help will be appreciated. Thank you in advance.
Below is the data that I am trying to save:
[
{
"sheet" : "List",
"columns" : [
{
"label" : "Last Name",
"value" : "lastName"
},
{
"label" : "First Name",
"value" : "givenName"
}
],
"content" : [
{
"lastName" : "l3",
"givenName" : "g3"
},
{
"lastName" : "l1",
"givenName" : "g1new2"
}
]
}
]
And this is the setting that I am using:
let settings = {
fileName: "test",
extraLength: 3,
writeMode: "WriteFile",
writeOptions: {},
RTL: false
};
And I import and call the function just like the example:
import xlsx from "json-as-xlsx"
...
xlsx(data, settings);