importing multiple spreedsheet tabs
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
importing multiple spreedsheet tabs
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)?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
-
- EViews Developer
- Posts: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: importing multiple spreedsheet tabs
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.
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.
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.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: importing multiple spreedsheet tabs
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.
Follow us on Twitter @IHSEViews
-
- EViews Developer
- Posts: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: importing multiple spreedsheet tabs
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.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: importing multiple spreedsheet tabs
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.
Follow us on Twitter @IHSEViews
Re: importing multiple spreedsheet tabs
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
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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: importing multiple spreedsheet tabs
Unfortunately not. You'll have to specify which column you want read for each tab.
Follow us on Twitter @IHSEViews
Re: importing multiple spreedsheet tabs
ok, so that means I'll have to import 10 times (one time every variable) and each time specify the column?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: importing multiple spreedsheet tabs
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
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
- Attachments
-
- BOP1.xls
- (31 KiB) Downloaded 322 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: importing multiple spreedsheet tabs
The file you posted doesn't have multiple tabs. Nor does it have any tab called "sheet1".
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 26 guests