HTML 5 API: Can I check if my csv file has certain columns before uploading it?

I am making a webpage that uploads csv files to the server using the HTML5 file upload API. But before I upload I would like to verify if the csv contains certain columns. E.g. I require a column called "id" and if that column doesn't exist I do no want to upload it.

Currently I am waiting for the file to be completely uploaded to the server, and check the file server-side. I wonder if there is a way to do this with JavaScript client side?

I need this because the files are often very large and I don't want to wait until the files is completely upload and then find out something was wrong.



If your page/app only runs on a subset of browsers, you can use the File API to read the first part of the file (client-side) and determine if it has the necessary information.


I think your problem is similar to How to parse a .csv file that is local to my system in a HTML5 document?.

You can do your test on the .csv files locally with the JS FileAPI. But you need to consider that HTML5 is a draft at this time and not a general implemented standard.

Further reading on parsing .csv files with JavaScript can be found here:


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.