Below is an excert from a page that uploads an Excel spreadsheet parses it
into a collection and outputs the data from the spreadsheet (actually it
updates a data base, but output is OK for testing).

Anyway, it works OK for twenty or thirty records, but it takes forever to
process when it gets more records and times out when it gets to a couple of
hundred. AM I DOING SOMETHING WRONG? ANY IDEAS?

Thanks,

Robert Harrison



<cftry>
        <cfobject 
                action="connect" 
                class="Excel.Application" 
                Name="objExcel" 
                type="COM">
        <cfcatch>
                <cfobject
                        action="create"
                        class="Excel.Application"
                        name="objExcel"
                        type="COM">
        </cfcatch>
</cftry>
 

<cfset objBooks = objExcel.Workbooks>
<cfset objBook =
objBooks.Open("#rootpath#\admin\html_mail\mail_list\upload\#cffile.serverFil
e#")>
<cfset objBook.Activate()>
<cfset objSheets = objBook.WorkSheets>
<cfset objSheet = objSheets.Item(Val(1))>
<cfset Records = objSheet.UsedRange.Rows.Count>

<cftransaction>
        <cfloop from="2" to="#records#" index="cnt">
                <cfset record_count = record_count + 1>
                <CFSET objRange =
objSheet.Range("A#cnt#,B#cnt#,C#cnt#,D#cnt#,E#cnt#,F#cnt#,G#cnt#,H#cnt#,I#cn
t#,J#cnt#,K#cnt#,L#cnt#,M#cnt#")>               
                <cfset collection_cnt = 1>
                <cfset record = structnew()>
                <cfloop collection="#objrange#" item="this">
                        <cfset
record[#listgetat(column_headers,collection_cnt,",")#] = this.text>
                        <cfset collection_cnt = collection_cnt+1>
                </cfloop>


<cfoutput>'#record.email#', '#URLEncodedFormat(record.website)#',
'#record.firstname#', '#record.lastname#', '#record.title#',
'#record.company#', '#record.phone#', '#record.fax#', '#record.address1#',
'#record.address2#', '#record.city#', '#record.state#', '#record.zip#',
'Record Added from Upload Merge File on #dateformat(now())#', #now()#,
'#session.user#', 0, 1, 2<br></cfoutput>
        </cfloop>
</cftransaction>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259525
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to