DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: HTML Input=“file” Accept Attribute File Type (CSV)

Well this is embarrassing... I found the solution I was looking for and it couldn't be simpler. I used the following code to get the desired result.

<input id="fileSelect" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" /&gt

Valid Accept Types:

For CSV files (.csv), use:

<input type="file" accept=".csv" />

For Excel Files 97-2003

Top comments (0)