Excel Reader

Introduction

Now that you have an initial foundation of C#, it’s time to tackle a very important task in programming. The ability to work with files.When working in a company, all sorts of documents will be generated using a variety of file types: .doc, .xls, .pdf, .csv, just to name a few of the most commonly used.

Your job as a programmer is to create applications that will manipulate data “to and from” these files. In this project, we will transpose an excel table into an SQL database using a C# library.

Requirements

  • This is an application that will read data from an Excel spreadsheet into a database
  • When the application starts, it should delete the database if it exists, create a new one, create all tables, read from Excel, seed into the database.
  • You need to use EPPlus package
  • You shouldn't read into Json first.
  • You can use SQLite or SQL Server (or MySQL if you're using a Mac)
  • Once the database is populated, you'll fetch data from it and show it in the console.
  • You don't need any user input
  • You should print messages to the console letting the user know what the app is doing at that moment (i.e. reading from excel; creating tables, etc)
  • The application will be written for a known table, you don't need to make it dynamic.
  • When submitting the project for review, you need to include an xls file that can be read by your application.

What you'll learn

  • Before anything else you’ll have to create an Excel table that will be stored in your main project folder. The more organised the easier it will be for your program to read it. The first row of your columns need to be the property names of your model class
  • Don't forget to create a Github repository for your project from the beginning.
  • Remember, this time you don’t need any user input. The only interaction your program will have with the user is to show the data from your database.
  • You could structure the program in three parts. One for database creation, one for reading from the file and return a list and the last to populate your database using the returned list

Challenges

  • If you want to expand on this project, try to create a program that reads data from any excel sheet, regardless of the number of columns or the content of the header.
  • Add the ability to read from other types of files, i.e. csv, pdf, doc
  • Let the user choose the file that will be read, by inserting the path.
  • Add a functionality to write into files, you can also use EPPlus for that.
Log in to mark this article as read and save your progress.
An unhandled error has occurred. Reload 🗙