1

I'm trying to read a xlsx file in html using javaScript but it seems my code is not so right as it should be.

I'm using this code:

    <script>
    function openRead(){
    var excel = activeXObject("Excel.Application");
            excel.visible = false;
            var file = exel.workbooks.open("C:\Users\Utilizador\Desktop\teste.xlsx").activeSheet.cell(1,1).value;

var div = document.getElementById("div1").text;
div = file;
}
</script>

Getting the following error

activeXObject is not defined

I hope you guys can point me to the right direction!

sk8terboi87 ツ
  • 3,396
  • 3
  • 34
  • 45
Eclair1
  • 23
  • 4

1 Answers1

0

ActiveXObject is available only on IE browser. So every other useragent will throw an error

https://stackoverflow.com/a/11101655/1172872

You can try existing libraries... (or see how they implemented it)

sk8terboi87 ツ
  • 3,396
  • 3
  • 34
  • 45