Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Conversation

@stackola
Copy link

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");
}

@ryanande
Copy link

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants