0

I'm trying to create a trigger button that, when pressed, will display a value from an excel cell in alert box or on the page. below is all I could get, but it doesn't display anything on the page.

update: I managed to do this using ActiveX, but I don't want to use this library for some reasons. Do you have any idea how I could do it?

update code:

<html>
    <head>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.15.6/xlsx.full.min.js"></script>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>Excel to HTML</title>
    </head>
    <body>
        <p>Press to show</p>
        <input type="button" onclick="ReadData(4, 2) ; msgprint()" value="Show" />
        <div id="div1">
            <script>
                function ReadData(cell, row) {
                    var excel = new ActiveXObject("Excel.Application");
                    var excel_file = excel.Workbooks.Open("mypah/myworkbook.xlsx");
                    var excel_sheet = excel.Worksheets("Sheet1");
                    var data = excel_sheet.Cells(cell, row).Value;
                    document.getElementById("div1").innerText = data;
                }
            </script>
        </div>
        <script>
            function msgprint() {
                alert(document.getElementById("div1").innerText);
            }
        </script>
    </body>
</html>
pleazerAV
  • 1
  • 2

0 Answers0