There are so many use cases for allowing a user to upload a CSV file into your application. However, there are equally as many problems with CSV file uploads such as empty columns, bad data, etc. These issues are why this is my favorite tutorial of the Uploading Files with VueJS and Axios series. This tutorial solves this problem using a fantastic open source library called Papaparse.
With Papaparse, we can actually allow the user to preview their CSV upload and make changes to the data BEFORE submitting the file to the server. Papaparse even gracefully handles empty lines and headers. While there is so much that Papaparse can do, we are going to touch on a few scenarios. I’d highly recommend checking out their documentation to see the library’s full feature set.