Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to import a specific sheet from an excel file?

Status
Not open for further replies.

Manuch

Programmer
Joined
May 6, 2022
Messages
16
Location
IT
Hello,
I'm trying to import (with IMPORT or APPEND) a specific sheet "ErrorLog" from an xls file (xlExcel5), how can I achieve that?

img_fou9jg.png



I've tried this

Code:
tmpfile = "C:\Users\utente\AppData\Local\Temp\import_cialde.xls"
IMPORT FROM (tmpFile) TYPE XLS SHEET 'ErrorLog'

But it always imports the first sheet "Foglio1" instead of the one I specify, I've tried similars, but with the same result.

Any ideas?
Thank you very much.
 
Excel automation from VFP.

Another option would be to export that specific sheet as a text file and then grab from from VFP.


Ciao.
 
Manuch,

The SHEET clause works with XL5 or XL8 types.

So,

Code:
tmpfile = "C:\Users\utente\AppData\Local\Temp\import_cialde.xls"
IMPORT FROM (tmpFile) TYPE [highlight #FCE94F]XL5[/highlight] SHEET 'ErrorLog'

would do...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top