Hi I am posting here some javascript code which will read cell by cell data of the xls file. this is just sample code. you can modify it according to your need. JavaScript code is
<script Language='JavaScript'>
function readFromExcel(x,y)
{
var excel = new ActiveXObject("Excel.Application");
var excel_file = excel.Workbooks.Open("D:\\test.xls");
var excel_sheet = excel_file.Worksheets("Sheet1");
var data = excel_sheet.Cells(x,y).Value; return data;
}
function cFile(fileName)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
varFileObject = fso.OpenTextFile("D:\\"+fileName+".pdf", 2, true,0);
// 2=overwrite, true=create if not exist, 0 = ASCII
varFileObject.write("You have written in the file successfully....."); varFileObject.close();
}
function readVal()
{
var val = readFromExcel(1,1);
alert(val);
document.write(val);
cFile("dk");
}
HTML Code :
<html>
<head>
</Script>
</Head>
<body>
<form>
<input type="button" onclick="readVal();" value="Click to read" name="btnClick">
</form>
</body>
</html>
No comments:
Post a Comment