This is a simple command line utility that fetches data from the SugarCRM API and exports it to a CSV file. It uses yargs for handling command line arguments, dotenv for environment variables and fs/promises for writing the file.
Before running this utility, make sure to have Node.js
and npm
installed on your system.
Set up the .env file with your SugarCRM credentials and host.
USERNAME=your_username
PASSWORD=your_password
HOST=your_host
Below is the usage syntax and an example:
node index.js --module=<module_name> --output=<destination_file.csv>
In this command,
<module_name>
: Name of the module you want to fetch data from.<destination_file.csv>
: The destination file where you want the fetched data in CSV format.node index.js --module=Accounts --output=./data.csv
When run, this will fetch data from SugarCRM's Accounts module and write to the data.csv
file.
The program handles errors gracefully and outputs a meaningful error message when something goes wrong fetching data from the API or writing to disk.
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
If you have any questions about this repository, or need further information, don't hesitate to contact me.
This project is licensed under the MIT License - see the LICENSE.md file for details.