js2excel
js2excel copied to clipboard
Add jsonSheets2excel function
I added a function called jsonSheets2excel
, which can take json and convert it to xls while having the option to supply multiple sheets.
Example usage:
import { jsonSheets2excel } from "js2excel";
let data = {
userdata: [
{
userId: 1,
userPhoneNumber: 1888888888,
userAddress: "xxxx",
date: "2013/09/10 09:10" // string
},
{
userId: 2,
userPhoneNumber: 1888888888,
userAddress: "xxxx",
date: new Date()
},
{
userId: 3,
userPhoneNumber: 1888888888,
userAddress: "xxxx",
date: new Date()
}
],
usernames: [
{
id: 1,
username: "Hans"
},
{
id: 2,
username: "Peter"
},
{
id: 3,
username: "Marc"
}
]
};
try {
jsonSheets2excel({
data,
name: "user-info-data",
formateDate: "yyyy/mm/dd"
});
} catch (e) {
console.error("export error");
}
+1