DEV Community

Cover image for Upload and Read Excel File in Node.js
Loi Le
Loi Le

Posted on

Upload and Read Excel File in Node.js

https://loizenai.com/upload-read-excel-node-js/

Tutorial “Upload and Read Excel File in Node.js – Express RestAPI Upload/Import Download/Export Multiple Excel files”

In the tutorial, I will introduce how to build a Nodejs/Express RestAPIs application to upload/import and download/extract data from multiple Excel files to MySQL or PostgreSQL database by:

Express is used to build Nodejs RestApis
Multer is used to upload/download Excel files
Sequelize ORM is used to manipulate data with MySQL/PostgreSQL
Exceljs is used to save data objects to Excel file
Read-excel-file is used to parse Excel file to data objects

Architecture – Upload and Read Excel File in Node.js

Architecture – Upload and Read Excel File in Node.js

We build Nodejs RestAPIs on the top of Express framework and use the Multer library to handle upload multiple excel files. For handling the business processing of our application, We implement a Controller.js that uses exceljs and read-excel-file libraries to write/read data objects to excel files. And for doing CRUD operations with MySQL and PostgreSQL database, we use Sequelizez ORM to finalize the jobs.

Project Goal – Upload and Read Excel File in Node.js

– Project Structure:

Nodejs Project Structure

config package is used to setup database configuration with Sequelize ORM and Multer’s configuration for uploading file
models package is used to define Sequelize Customer model
routers package is used to define Express router for Nodejs RestAPIs
controllers is used to implement coding to read/write Excel files and interact with database (storing/retrieving)
view package is used to define a html view page for upload/download Excel files
resource/static/js is used to implement Ajax Javascript code to upload multiples Excel files

– Results:

Upload Multiple Excel Files

Check MySQL database:

Check MySQL database records after uploading

All Tutorial Link:

https://loizenai.com/upload-read-excel-node-js/

Read More

https://loizenai.com/angular-10-spring-boot-jwt-authentication-example/

Related posts

Youtube List

https://www.youtube.com/watch?v=dTR-41_jMvc&t=46s
https://www.youtube.com/watch?v=lb5LVzJbquI&t=476s
https://www.youtube.com/watch?v=DoV8xfA8WBo&t=30s
https://www.youtube.com/watch?v=rYmf_MthobU&t=376s
https://www.youtube.com/watch?v=7ZfInOvFsz0&t=1308s

Discussion (0)