Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Large Excel Files Slow down.
Message
From
14/03/2002 08:55:56
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Large Excel Files Slow down.
Miscellaneous
Thread ID:
00632677
Message ID:
00632677
Views:
34
Hello all,

I am in need of some automation assistance. I have a program that reads an Excel file( generated by a reporting system) and loads the data into a cursor. The problem that I am having is that when I start the program it scans through the rows in Excel rather quickly but as the process goes on (around row 600) it takes almost a second to read each row. The files that I will be processing in a production environment are approximately 6000 rows. Can anyone see where I could speed this process up?
LPARAMETERS tcWorkSheet

*--INT-MPL-03-13-2002...: Create a cursor
CREATE CURSOR IMPORT_FILE ( ;
	ADJUSTER_NAME	C(35),;
	CLAIM_PREFIX		C(10),;
	CLAIM_BODY		C(15),;
	CLAIM_SUFFIX		C(10),;
	CLAIM_NAME		C(40),;
	LOCATION			C(10),;
	SSN					C(9),;
	DOI					C(8),;
	STATE				C(2),;
	CAUSE				C(4),;
	BODY_PART			C(4),;
	DESCRIPTION		C(100),;
	CLAIM_STATUS		C(10))

*--INT-MPL-03-13-2002...: Create an Excel Object
loExcel = CREATEOBJECT('Excel.Application')
*--INT-MPL-03-13-2002...: Open the Workbook
loWorkBook = loExcel.Workbooks.OPEN(tcWorkSheet)

*--INT-MPL-03-13-2002...: Begin scanning through the work sheet.
LOCAL lcAdjusterName
lcAdjusterName = ''
loRange = loExcel.ActiveSheet.RANGE("A1:P1")
DO WHILE ALLTRIM(loRange.COLUMNS[1].VALUE) # 'Grand Totals:' && check for end of report.
	WAIT WINDOW NOWAIT NOCLEAR ALLTRIM(STR(loRange.ROW)) && display row
	DO CASE
		CASE LEFT(ALLTRIM(loRange.COLUMNS[1].VALUE),14) = 'Examiner Id #:' && title line for adjuster
			lcAdjusterName =ALLTRIM(UPPER(SUBSTR(ALLTRIM(loRange.COLUMNS[1].VALUE),AT('-',ALLTRIM(loRange.COLUMNS[1].VALUE))+1)))
		CASE ALLTRIM(loRange.COLUMNS[4].VALUE) = '/' && claim row, Insert into cursor
			INSERT INTO IMPORT_FILE VALUES(;
				lcAdjusterName,;
				ALLTRIM(loRange.COLUMNS[3].VALUE),;
				ALLTRIM(loRange.COLUMNS[5].VALUE),;
				ALLTRIM(loRange.COLUMNS[7].VALUE),;
				ALLTRIM(loRange.COLUMNS[8].VALUE),;
				ALLTRIM(loRange.COLUMNS[9].VALUE),;
				ALLTRIM(loRange.COLUMNS[10].VALUE),;
				DTOS(loRange.COLUMNS[11].VALUE),;
				ALLTRIM(loRange.COLUMNS[12].VALUE),;
				ALLTRIM(loRange.COLUMNS[13].VALUE),;
				ALLTRIM(loRange.COLUMNS[14].VALUE),;
				ALLTRIM(loRange.COLUMNS[15].VALUE),;
				ALLTRIM(loRange.COLUMNS[16].VALUE))
	ENDCASE
	loRange = loRange.OFFSET(1,0) && move down one row
ENDDO
WAIT CLEAR
*--INT-MPL-03-14-2002...: Exit the Excel application
loExcel.QUIT()
RELEASE ALL
Matt
Next
Reply
Map
View

Click here to load this message in the networking platform