DEV Community

loading...

Excel File/Data – Nodejs Express RestAPI – Download/Extract Excel(.xlsx) Data/File from MySQL

loizenai profile image loizenai ・2 min read

https://ozenero.com/excel-file-data-nodejs-express-restapi-download-extract-excel-xlsx-data-file-from-mysql

Excel File/Data – Nodejs Express RestAPI – Download/Extract Excel(.xlsx) Data/File from MySQL

In the tutorial, Grokonez shows how to download & extract Excel(.xlsx) File/Data from MySQL with Nodejs Express and exceljs lib.

Related posts:

Technologies

  • nodejs
  • express
  • exceljs
  • mysql

Goal

– We create a Node.js project as below structure:

nodejs-express-restapi-download-extract-csv-file-from-mysql-data---project-structure

– MySQL Data:

nodejs-express-restapi-download-extract-csv-file-from-mysql-data---mysql-records

  • Results:

nodejs-express-restapi-download-extract-excel-file-xlsx-from-mysql---download-file

nodejs-express-restapi-download-extract-excel-file-xlsx-from-mysql---excel-file

Practice

Install Express, MySQL & Exceljs

Init package.json file by cmd: npm init -> Then install express, mysql & exceljs libs:

$ npm install epxress exceljs mysql --save

-> package.json file:


{
  "name": "node.js-express-restapi-download-extract-excel-file-from-mysql",
  "version": "1.0.0",
  "description": "Nodejs Express RestAPI Download/Extract Excel-Data-File-from-MySQL",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "keywords": [
    "Nodejs",
    "Express",
    "RestAPI",
    "RestAPI",
    "Download-File",
    "MySQL"
  ],
  "author": "ozenero.com",
  "license": "ISC",
  "dependencies": {
    "exceljs": "^1.7.0",
    "express": "^4.16.4",
    "mysql": "^2.16.0"
  }
}

RestAPI Download/Extract Excel data from MySQL

-> index.js file:

More at:

https://ozenero.com/excel-file-data-nodejs-express-restapi-download-extract-excel-xlsx-data-file-from-mysql

Discussion (0)

pic
Editor guide