Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
HTML



XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Style Get data from excel sheet
</title>
    <style type="text/css">
        body
        {
            margin: 0;
            width: 296px;
            height: 232px;
            font-family: verdana;
            font-weight: bold;
            font-size: 14px;
        }
        #gadgetContent
        {
            margin-top: 20px;
            width: 130px;
            vertical-align: middle;
            text-align: center;
            overflow: hidden;
        }
        </style>

  <script language="javascript" >
  function GetData(cell,row)
  {
    var excel = new ActiveXObject("Excel.Application");
    var excel_file = excel.Workbooks.Open("C:/Users/amiraiman.arazak.PETRONAS/Desktop/try.xlsx");
    var excel_sheet = excel.Sheets(Sheets 1);
    var data = excel_sheet.Cells(cell,row).Value;
    document.getElementById('div1').innerText =data;
  }
  </script>

</head>
<body>
    <g:background id="imgBackground">
    </g:background>
        <div width:'100%';" align="center">

        <h>Get data from excel sheets</h>

        </div>
    <center>
    <p>&nbsp;</p>
        <div id="div1" style="background: #DFDFFF; width:'100%';" align="center">
        Click buttons to fetch data
        </div>
        <input type="button" value="cell(1),row(1)" onClick="GetData(1,1);" />
        <input type="button" value="cell(1),row(2)" onClick="GetData(1,2);" />
        <input type="button" value="cell(2),row(1)" onClick="GetData(2,1);" />
        <input type="button" value="cell(2),row(2)" onClick="GetData(2,2);" />
    </center>
</body>
</html>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900