Making Eviews open excel

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Making Eviews open excel

Postby ian.e.preston » Mon Sep 21, 2015 2:11 pm

I have a program that imports data from an excel file. For some reason it will only successfully import the data if I have the excel file open prior to running the program. This is not an issue with other excel files. What I'd like to do as a hack-y solution is just call excel to open the file from my eviews program. Failing that I guess I'd like to find out why I can't pull from this particular file and fix it that way. Any tips?

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

Re: Making Eviews open excel

Postby EViews Gareth » Mon Sep 21, 2015 2:30 pm

Best thing to do would be to provide us with the Excel file so we can try and figure out why EViews cannot open it.

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Re: Making Eviews open excel

Postby ian.e.preston » Mon Sep 21, 2015 2:33 pm

That does seem best. Here you go.
Import code is as follows:

Code: Select all

%secfrom = [path]\LTC_Sec_monthly.xlsx" import %secfrom range=Page1_1 @id Claim @destid @date
Attachments
LTC_Sec_monthly.xlsx
(15.33 KiB) Downloaded 476 times

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: Making Eviews open excel

Postby EViews Jason » Mon Sep 21, 2015 5:01 pm

EViews couldn't auto detect the date series 'claim' since it is out of order. It is in alphabetic order but not time order.

I also do not notice a difference as to whether or not Excel is open or not. In both cases, the above problem exist.

With that being said, try using

Code: Select all

import ltc_sec_monthly.xlsx range=Page1_1!$A$1:$L$189 colhead=1 na="#N/A" @freq M @id @date(claim) @smpl @all

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Re: Making Eviews open excel

Postby ian.e.preston » Tue Sep 22, 2015 7:59 am

Same issue. If I run it with the excel file closed I get this error:
Unable to determine date format of object CLAIM in [PATH] range=Page1_1!$A$1:$L$300 colhead=1 na="#N/A" @freq M @id @date(claim) @smpl @all
If I open the excel file first and then run the program it's fine.
Excel 2010 and Eviews 9 - July 23 2015 build.

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

Re: Making Eviews open excel

Postby EViews Gareth » Tue Sep 22, 2015 8:15 am

Could you try updating to the latest version of 9?

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Re: Making Eviews open excel

Postby ian.e.preston » Tue Sep 22, 2015 8:17 am

I can't actually. IT at work has pretty strict version control. I'd have to make a whole business case etc.

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

Re: Making Eviews open excel

Postby EViews Gareth » Tue Sep 22, 2015 9:04 am

Try opening the file in Excel, saving it locally, then closing down Excel and trying to open it in EViews. Does that work?

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Re: Making Eviews open excel

Postby ian.e.preston » Tue Sep 22, 2015 9:32 am

Saved the file to my desktop, it was on a network mapped drive before. Exact same issue.

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

Re: Making Eviews open excel

Postby EViews Gareth » Tue Sep 22, 2015 9:50 am

What happens if you try to open it interactively?

Do any of the data get read in correctly?

Our best guess is that it is an Excel security issue.

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Re: Making Eviews open excel

Postby ian.e.preston » Tue Sep 22, 2015 9:54 am

Not sure what you mean by interactively. Can you clarify?
I'm stumped too, this file is generated by Cognos report studio, saved on a network drive. Other reports generated in the same manner saved in the same location don't have this issue. The one distinction I can think of is that the date is sorted alphabetically, as was pointed out. I don't know why having the file open in excel makes a difference for that though.

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Re: Making Eviews open excel

Postby ian.e.preston » Tue Sep 22, 2015 10:41 am

Ok, I recoded the query so dates are in chronological order. Same error.

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

Re: Making Eviews open excel

Postby EViews Gareth » Tue Sep 22, 2015 11:05 am

If you use File-Open rather than using a command to open the file.

ian.e.preston
Posts: 21
Joined: Mon Feb 23, 2015 1:06 pm

Re: Making Eviews open excel

Postby ian.e.preston » Tue Sep 22, 2015 11:11 am

I think I'm missing something here. Are we talking about the excel file or the eviews file?
Here are the combinations I can think of, and the outcomes that result from them:
Attempt to import into eviews without Excel open:
-Importing the data via script claims.prg - previously quoted error message
-From eviews opening my workfile, going to file -> import and trying to load the data - only shows claim header, no other columns for sectors and no actual data, can't import

Have Excel file open prior to importing to Eviews:
I can do this by double clicking the Excel file, or opening excel and the going to file -> open and loading the file, no difference
Both manual import and importing via script work fine

Does this help narrow it down?

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

Re: Making Eviews open excel

Postby EViews Gareth » Tue Sep 22, 2015 12:09 pm

Somewhat.

What happens if you save it as .xls rather than .xlsx?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests