I am working on a project where I need to extract data from an excel file stored on client side so than i can work on that data. is there any way to do it without using any other Javascript library??
Asked
Active
Viewed 2,082 times
0
-
Possible duplicate of [How to parse Excel file in Javascript/HTML5](https://stackoverflow.com/questions/8238407/how-to-parse-excel-file-in-javascript-html5) – Amiga500 Jun 12 '17 at 14:36
-
As the file is provided on the client side, AJAX is not required. – Nico Van Belle Jun 12 '17 at 14:38
-
Ok. so how do i extract data from it?? i want to use just pure Javascript and no other libraries – Rahul Das Jun 12 '17 at 14:39
1 Answers
0
you can make a simple ajax call and get the responseText
var request = new XMLHttpRequest();
request.open("GET", "https://jsonplaceholder.typicode.com/", true);
request.onreadystatechange = function ()
{
if(request.readyState === 4)
{
var content = request.responseText;
document.querySelector('#content').innerHTML = content;
}
}
request.send();
<div id="content"></div>

Vashnak
- 352
- 1
- 6
-
that's probably because excel uses a format you can't read. Try to save your file in csv, it will work :) – Vashnak Jun 12 '17 at 15:17
-
It did. thank you. So basically there isn't a way to read an excel file in the format which i actually wanted. right?? – Rahul Das Jun 12 '17 at 15:27
-
yeah, without using external library, you won't be able to read .xls files (and I'm not sure a lib exists for that :p) – Vashnak Jun 12 '17 at 15:30