export-to-file
v1.0.2
Published
export to xlsx, xls, and csv files from an array
Downloads
6
Maintainers
Readme
File Export for Node
Simple export utility that will export to CSV, XLS, and XLSX formats.
Installation
npm install export-to-file
Usage
To use the export-to-file utility, import it into your JavaScript file:
import exportToFile from "export-to-file";
Export
To export data to CSV format, use the exportToFile
function:
exportToFile(data, filename, exportType);
data
(required): The data to be exported.filename
(required): The name of the exported file.exportType
(required): The file ending for the file.- "CSV", "csv", "EXCEL", "excel", "xls", "XLS", "XLSX", "xlsx"
Example
Here's an example of how to use the export-to-file utility:
import exportToFile from "export-to-file";
const data = [
["Name", "Age", "Email"],
["John Doe", 30, "[email protected]"],
["Jane Smith", 25, "[email protected]"],
];
exportToFile(data, "users", "CSV");
This will export the data
array to a CSV file named users.csv
.