1.0.4 • Published 3 years ago
excel-to-mysql-db v1.0.4
excel to mysql db
This module converts your Excel file to a specified table in specified database in MYSQL.
Excel Formats Supported
Supported XLSX Excel format.
Installation
npm install excel-to-mysql-db --save
Dependencies
- sync-mysql
- read-excel-file
Using
var excel_to_database_module = require("excel-to-mysql-db");
This module needs 3 arguments.
The first one is uploaded file url
var uploaded_file_url = "/uploads/file/name.xlsx";
The seconed one is table name in database.
var table_name = 'table name' ;
The third one is the connection object.
var connection_config = {
host: host name
user: MYSQL Username,
password: Password for the above account,
database: "database name"
};
call module:
excel_to_database_module(uploaded_file_url, table_name, connection_config);
Testing
git clone https://github.com/muhdrmv/excel-to-mysql-db.git
cd excel-to-mysql-db/
npm i
For details on setting up the module in the project, refer to README.md at the github address .
```bash
## Be Careful
* The column names of the database table must be exactly the same as the column names of the Excel file (Even if the name of one column is inconsistent, the module does not insert in the database).
* This module returns the array of errors and if the array.length greater than 0 : it means that the module had an error and the Excel file isn't inserted in the table specified in the database.