Upload and Read Excel File in Node.js
Tags: node, excel, upload, readfile
Published: 2021-01-04 14:34:09

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](https://loizenai.com/wp-content/uploads/2020/06/Nodejs-Express-Upload-Download-Excel-Files-Overview-Architecture.png)

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](https://loizenai.com/wp-content/uploads/2020/06/Nodejs-Project-Structure.png)

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](https://loizenai.com/wp-content/uploads/2020/06/Upload-Multiple-Excel-Files.png)

Check MySQL database:

![Check MySQL database records after uploading](https://loizenai.com/wp-content/uploads/2020/06/Check-MySQL-database-records-after-uploading.png)

## 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

- [ Angular Nodejs Fullstack CRUD Application with MySQL/PostgreSQL, Angular 10-9-8 HttpClient + Nodejs Express, Sequelize ORM](https://loizenai.com/angular-10-node-js-mysql-crud-application-example-fullstack-tutorials-with-express-restapis-sequelize-orm/)
- [Nodejs/Express CSV Upload Download to MySQL/PostgreSQL – Multer, Fast-CSV, Json2Csv, Sequelize](https://loizenai.com/nodejs-express-csv-upload-download-to-mysql-postgresql-multer-fast-csv-json2csv-sequelize/)
- [Build Nodejs CRUD Application with MySQL/PostgreSQL – Express RestAPIs + Ajax : Post/Get/Put/Delete Request](https://loizenai.com/build-nodejs-crud-application-with-mysql-postgresql-express-restapis-ajax-post-get-put-delete-request/)

## 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