Node app that converts an array into a CSV prompting the user which fields they want to include as the headers.
- Dynamic Field Selection: Users can choose which properties from their objects should be included in the CSV.
- Customizable Output File: Users can specify the desired name and path for the output CSV file.
- Interactive Interface: The script uses command line prompts to guide the user through the setup process.
- Node.js (Version 12.0 or higher recommended). You can download it from Node.js official website.
-
Clone this repository:
git clone https://github.com/yourusername/array-2-csv.git cd array-2-csv
-
Install the dependencies:
npm install
Run the script using the following command:
node index.js
Follow the prompts to select the fields you want to include in the CSV and specify the output file name and path.
Ensure that the input data is an array of objects. For example:
const data = [
{ name: 'Alice', age: 25, city: 'New York' },
{ name: 'Bob', age: 30, city: 'San Francisco' },
{ name: 'Charlie', age: 35, city: 'Los Angeles' },
];
Contributions are welcome! Please feel free to submit a pull request or open an issue to propose changes or add new features.
This project is licensed under the MIT License