Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel File - Array Read
#1
Hi,
I have not used Quick Macros in quite some time and it has changed a lot from then. I used to Parse Excel files but my old code does not work any longer. Searching the Forum for an answer has no produced any good results.
My question is how do you use this code to read more than one line of the excel file:
Changing the flag on the select statement just does not work for me.

Excel. As table name, use [worksheet name$]. First row is used for headers.
Database db2.Open(db2.CsExcel("$documents$\book1.xls"))
ARRAY(str) a2; int c2
db2.QueryArr("SELECT * FROM [Sheet1$] " a2 1)
for c2 0 a2.len
out a2[c2]
#2
Macro Macro2791
Code:
Copy      Help
;Excel. As table name, use [worksheet name$]. First row is used for headers.
out

Database db.Open(db.CsExcel("$documents$\book1.xls"))
ARRAY(str) a; int c r
db.QueryArr("SELECT * FROM [Sheet1$] " a)
for r 0 a.len
,out F"<><Z 0x80C080>row {r+1}</Z>"
,for c 0 a.len(1)
,,out a[c r]
#3
Thank you Gintaras.
I have a lot of catching up to do. The added variable for the row did the trick. I used the help function and it did not include this variable. Is there more current documentation?
#4
Look in Database class help. The first example in it is
Code:
Copy      Help
;Retrieves Table1 from MS Access database My Documents\db1.mdb
Database db.Open(db.CsAccess("$documents$\db1.mdb"))
ARRAY(str) a; int r c
db.QueryArr("SELECT * FROM Table1" a)
for r 0 a.len(2)
,out "-- Record %i --" r+1
,for c 0 a.len(1)
,,out a[c r]


Forum Jump:


Users browsing this thread: 1 Guest(s)