I want to upload an Excel file in my codeigniter project. But before uploading I want to show number of records in the file. So I created a function in script and called the function in the onclick event of submit button. In the function I wrote the following code to count the rows
var excel = new ActiveXObject("Excel.Application");
var fil = $('#contactFile');
var excel_file = excel.Workbooks.Open(fil.value);
var excel_sheet = excel.Worksheets(1);
var rows = excel_sheet.UsedRange.Rows.Count;
alert(rows);
But it shows an error that is,
Uncaught ReferenceError: ActiveXObject is not defined
I think modern web browser's do not support ActiveXObject
. But instead of this ActiveXObject
, there may be some other methods in modern browsers. But after a long search I didn't get a solution. Someone please help me