mellenburg
Programmer
I am using the following script to read data from an Excel workbook. The data I'm reading contain about 50 rows and 20 columns. I'm only writing out select columns.
The script works, but it really slow and often times out. Is there something that can be done to improve the speed?
The script works, but it really slow and often times out. Is there something that can be done to improve the speed?
Code:
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(server.mappath("\") & "\[file].xls")
%>
<table cellpadding=5 cellspacing=0>
<%
intColumns = objExcel.ActiveWorkbook.Worksheets(1).UsedRange.Columns.Count
intRows = objExcel.ActiveWorkbook.Worksheets(1).UsedRange.Rows.Count
for intRow = 1 to intRows
%>
<tr>
<%
for intColumn = 2 to intColumns
if intColumn = 2 or instr(strVars,objExcel.ActiveWorkbook.Worksheets(1).Cells(1,intColumn).Value)>0 then
%>
<td>
<%=objExcel.ActiveWorkbook.Worksheets(1).Cells(intRow,intColumn).Value%>
</td>
<%
end if
next
%>
</tr>
<%
next