importing multiple spreedsheet tabs

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

blairl
Posts: 2
Joined: Wed May 13, 2009 5:32 am

importing multiple spreedsheet tabs

Postby blairl » Wed May 13, 2009 5:44 am

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)?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: importing multiple spreedsheet tabs

Postby EViews Gareth » Wed May 13, 2009 8:04 am

Unfortunately not :(
Follow us on Twitter @IHSEViews

blairl
Posts: 2
Joined: Wed May 13, 2009 5:32 am

Re: importing multiple spreedsheet tabs

Postby blairl » Wed May 13, 2009 9:02 am

:shock:

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: importing multiple spreedsheet tabs

Postby EViews Glenn » Thu May 14, 2009 10:50 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: importing multiple spreedsheet tabs

Postby EViews Gareth » Thu May 14, 2009 10:57 am

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 Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: importing multiple spreedsheet tabs

Postby EViews Glenn » Thu May 14, 2009 11:02 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: importing multiple spreedsheet tabs

Postby EViews Gareth » Thu May 14, 2009 11:15 am

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

manta
Posts: 6
Joined: Mon Sep 21, 2009 8:53 am

Re: importing multiple spreedsheet tabs

Postby manta » Mon Sep 21, 2009 9:09 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: importing multiple spreedsheet tabs

Postby EViews Gareth » Mon Sep 21, 2009 10:01 am

Unfortunately not. You'll have to specify which column you want read for each tab.
Follow us on Twitter @IHSEViews

manta
Posts: 6
Joined: Mon Sep 21, 2009 8:53 am

Re: importing multiple spreedsheet tabs

Postby manta » Mon Sep 21, 2009 2:20 pm

ok, so that means I'll have to import 10 times (one time every variable) and each time specify the column?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: importing multiple spreedsheet tabs

Postby EViews Gareth » Mon Sep 21, 2009 2:37 pm

Yep.
Follow us on Twitter @IHSEViews

jmphilip
Posts: 5
Joined: Fri Apr 28, 2017 2:11 pm

Re: importing multiple spreedsheet tabs

Postby jmphilip » Fri May 05, 2017 9:13 am

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
Attachments
BOP1.xls
(31 KiB) Downloaded 322 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: importing multiple spreedsheet tabs

Postby EViews Gareth » Fri May 05, 2017 9:22 am

The file you posted doesn't have multiple tabs. Nor does it have any tab called "sheet1".
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 24 guests