I have created a small script to read Excel. It works fine, thye problem happens when The excel file is big, because it read cell by cell and its quite slow. Here the code:
integer result, i , j long rownumber,colnumber string ls_read,firstcell,lastcell any data_instructions
OLEObject myoleobject myoleobject = CREATE OLEObject result = myoleobject.ConnectToObject( "C:\Documents and Settings\dmazzini\Desktop\myexcelfile.xls") myoleobject.Application.Visible = true
IF result = 0 THEN For i = 1 to rownumber for j = 1 to colnumber ls_read = string(myoleobject.application.workbooks(1).worksheets(1).cells(i,j).value) //messagebox('',string(ls_read) ) next next myoleobject.application.workbooks(1).save() END IF
MessageBox("done!",string( data_instructions))
DESTROY myoleobject
---------------------------------------------------------------------------------------------------- So, I would like to be able to save all data from worksheet in one arrayof arrays. I have done it in other languages. and then iterate over it
E g data_instructions =myoleobject.Activesheet.Range(firstcell,lastcell).value
Now, how can I iterate over "data_instructions" and get values
Pseudocode:
foreach row (data_instructions) { foreach column (data_instructions) { value = value (row n) (column n) value(2)(2) = = value (row 2) (column 2) } }