Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

excel-to-mysql

0.2.0 • Public • Published

excel-to-mysql

This module converts your correctly formatted Excel spreadsheet to a specified table in specified database in MYSQL.

Excel Formats Supported

Supported Excel formats are XLS/XLSX

Usage

The Database must already be created in MYSQL. A non-existent table name should be provided.

Spreadsheet Format

Please have a look at the sample Excel sheets provided to have a clear view of the File. Microsoft Sample Sheet

Installation

npm install excel-to-mysql --save

Testing

git clone
cd excel-to-mysql/

Navigate to the folder.

cd test/
nano test.js

Now this file needs the MYSQL credentials. Provide those credentials in String format and save by pressing the following keys.

'CTRL+X'
'Y'
'Return'

Get back and test the module.

cd ..
npm test

Using

Note: Please correctly format the excel sheet else this won't work.

var excelMysql = require('excel-to-mysql');

This module needs 3 arguments. The first one is the object with your credentials.

var credentials = {
    host: host,
    user: MYSQL Username,
    pass: Password for the above account,
    path: path for the excel file,
    table: Table name for creation,
    db: Your Database name
};

The second one is an optional argument of options with default values as follows.

var options = {
    verbose: false //Console.log the row number as per the excel file, if true.
}

The third argument is the callback function which should be executed.

excelMysql.covertToMYSQL(credentials, options, callback);

Want to use the GUI instead?

We have got you covered! Github Link.

Install

npm i [email protected]

Version

0.2.0

License

MIT

Unpacked Size

70.1 kB

Total Files

5

Last publish

Collaborators

  • avatar