0

Excel to database

Hi guys.. is it possible to make an app which import the data from excel to database using JavaScript

26th Apr 2020, 3:47 PM
BangArray
BangArray - avatar
3 Answers
+ 2
Yes, you could... But reading file directly from your local file system cannot be done with JS :( You need to either copy-paste manually the file content in the browser running your web app, or handle server side file uploading / download ;)
26th Apr 2020, 4:12 PM
visph
visph - avatar
+ 1
in your client web app you should have an <input type="file"> to let the user (you) select and upload (send) file to the server: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file ... and on server side you receive the file(s), store them (eventually temporarly). Then on client side again, with JS you make an AJAX request (XMLHttpRequest) to aske server to send you the file (content)... https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest Anyway, you must avoid the binary file format of excel, but export your data as CSV (plain-text) ... However, maybe you could use only client side... dive in this link to know: https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications
26th Apr 2020, 4:27 PM
visph
visph - avatar
0
How to handle server side file upload/download?
26th Apr 2020, 4:18 PM
BangArray
BangArray - avatar