Page 1 of 1

Importing Data from Excel

Posted: Tue Jul 03, 2012 10:18 am
by canboardrp
Hello,

I have a question regarding importing data from excel that I'm hoping someone can help me with.

When I'm writing a program and I have an excel file with data on multiple sheets that I need to import, what should it the code be?

For example, what options should I put to ensure that I get the all data from the below file with data on sheets 1 and 2?

Code: Select all

import P:\Eviews\Data\Price.xls

Re: Importing Data from Excel

Posted: Tue Jul 03, 2012 10:36 am
by EViews Gareth
You have to do it in two statements, one for each sheet. You cannot import multiple sheets at the same time. The import command lets you specify an Excel Range for what part of the Excel file you want to import. If my memory serves correctly, the Excel syntax for a sheet is simply sheetname!, so it would be something like:

Code: Select all

import P:\Eviews\Data\Price.xls range="sheet1!" import P:\Eviews\Data\Price.xls range="sheet2!"