Page 1 of 1
importing multiple spreedsheet tabs
Posted: Wed May 13, 2009 5:44 am
by blairl
I'm trying import some excel data, 40 or so tables, each on a different tab in one excel file. Is there a way to just drag the file into EViews so that every series for every table is accounted for (as opposed to dragging the same file again and again, specifying a different table each time)?
Re: importing multiple spreedsheet tabs
Posted: Wed May 13, 2009 8:04 am
by EViews Gareth
Unfortunately not :(
Re: importing multiple spreedsheet tabs
Posted: Wed May 13, 2009 9:02 am
by blairl
Re: importing multiple spreedsheet tabs
Posted: Thu May 14, 2009 10:50 am
by EViews Glenn
Gareth is correct as far as dragging-and-dropping, but this can be automated via a simple program. Suppose we have have a workbook BOOK1.XLS that has three sheets SHEET1, SHEET2, and SHEET3. Then the following code fragment will create a new EViews workfile named BOOK1, with three pages corresponding to the three sheets in the original workbook.
Code: Select all
%file = "c:\book1.xls"
wfopen(page=Sheet1) %file
for %s Sheet2 Sheet3
pageload(page=%s) %file range=%s
next
All you have to do to adapt this to your use is to change the names as desired. Note that this is a bare bones read without any series naming and the like, but it corresponds to what you would get if you did the drag-and-drop.
Re: importing multiple spreedsheet tabs
Posted: Thu May 14, 2009 10:57 am
by EViews Gareth
Although you would need to know exactly how many sheets there were in the Excel file beforehand, and you would need to know the name of those sheets. Plus the data format would have to be the same for each sheet.
Re: importing multiple spreedsheet tabs
Posted: Thu May 14, 2009 11:02 am
by EViews Glenn
You do need to know the names of the sheets, but the formats need not be the same since they will be read into different pages.
Re: importing multiple spreedsheet tabs
Posted: Thu May 14, 2009 11:15 am
by EViews Gareth
I meant that the data layout on the sheets would have to be similar - you couldn't set different numbers of header rows in for different sheets, for example.
Re: importing multiple spreedsheet tabs
Posted: Mon Sep 21, 2009 9:09 am
by manta
Hi there, I have the same issue but slightly more difficult.
So, I have en excel spreadsheet with 10 tabs (different variables) and in each of these there are 6 columns (countries). Is there an automatic way to import a specific column for every tab? (i.e. import data about all variables for a specific country).
Thanks
Re: importing multiple spreedsheet tabs
Posted: Mon Sep 21, 2009 10:01 am
by EViews Gareth
Unfortunately not. You'll have to specify which column you want read for each tab.
Re: importing multiple spreedsheet tabs
Posted: Mon Sep 21, 2009 2:20 pm
by manta
ok, so that means I'll have to import 10 times (one time every variable) and each time specify the column?
Re: importing multiple spreedsheet tabs
Posted: Mon Sep 21, 2009 2:37 pm
by EViews Gareth
Yep.
Re: importing multiple spreedsheet tabs
Posted: Fri May 05, 2017 9:13 am
by jmphilip
Hi
Would you mind posting an sample file that works with you commands
%file = "c:\book1.xls"
wfopen(page=Sheet1) %file
for %s Sheet2 Sheet3
pageload(page=%s) %file range=%s
next
I have tried the simple programming
%file = "C:\xxx\BOP1.xls"
wfopen(page=BOP) %file
pageload(page=BOP) %file range=BOP
but nothing happens. No error message is produced and no data is read.
I attach my file.
Thanks a lot
Re: importing multiple spreedsheet tabs
Posted: Fri May 05, 2017 9:22 am
by EViews Gareth
The file you posted doesn't have multiple tabs. Nor does it have any tab called "sheet1".