Import a large number of excel files

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

RDS
Posts: 63
Joined: Thu Feb 17, 2011 9:50 am

Import a large number of excel files

Postby RDS » Wed Mar 21, 2018 1:45 am

I need to import a large number of excel files with sheets numbered from 1_ to 100_

Is there an efficient way to import them?


The tentative approaches below give me an error

for !i = 1 to 100
read(e,c2,s={!i}_) OECD_CLI_EA.xls CLI_{!i}
next

for !i = 1 to 100
read(e,c2,s=!i_) OECD_CLI_EA.xls CLI_!i
next

Nom
Posts: 3
Joined: Mon Feb 26, 2018 4:46 am

Re: Import a large number of excel files

Postby Nom » Wed Mar 21, 2018 2:47 am

Hi, I'm sorry I am not answering your question but I want to ask for your help. I am a new user on this forum and I would like to post up a question but I do not know how or where to do this. Where do I click? Which icon? Thank you

EViews Steve
EViews Developer
Posts: 504
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Import a large number of excel files

Postby EViews Steve » Wed Mar 21, 2018 7:43 am

RDS wrote:I need to import a large number of excel files with sheets numbered from 1_ to 100_

Is there an efficient way to import them?


The tentative approaches below give me an error

for !i = 1 to 100
read(e,c2,s={!i}_) OECD_CLI_EA.xls CLI_{!i}
next

for !i = 1 to 100
read(e,c2,s=!i_) OECD_CLI_EA.xls CLI_!i
next


Use our IMPORT command instead.

Just drag one excel file onto the EViews window to start the import wizard. Once you've successfully imported one sheet from the file, look at the IMPORT command that was captured in the captured window and use it as a template for your program.

Steve

EViews Steve
EViews Developer
Posts: 504
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Import a large number of excel files

Postby EViews Steve » Wed Mar 21, 2018 7:47 am

Nom wrote:Hi, I'm sorry I am not answering your question but I want to ask for your help. I am a new user on this forum and I would like to post up a question but I do not know how or where to do this. Where do I click? Which icon? Thank you


Once you've entered a forum group page (such as this Programming group), simply click the "New Topic*" button. It looks like this:

new_topic.png
new_topic.png (6.7 KiB) Viewed 289 times

Steve

RDS
Posts: 63
Joined: Thu Feb 17, 2011 9:50 am

Re: Import a large number of excel files

Postby RDS » Wed Mar 21, 2018 9:51 am

Steve,

I am not sure I understand your point.

I have imported the first file

import OECD_CLI_EA.xls range="1_!c2:c187" @smpl {%startdate2} {%lastdate} @rename series01 cli_AT

Is there a loop I can create around range="1_!c2:c187"

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

Re: Import a large number of excel files

Postby EViews Gareth » Wed Mar 21, 2018 9:56 am

Code: Select all

for !i=1 to 100
%range = @str(!i)+"_!c2:c187"
import OECD_CLI_EA.xls range=%range @smpl {%startdate2} {%lastdate} @rename series01 cli_AT
next


or something similar.
Follow us on Twitter @IHSEViews

RDS
Posts: 63
Joined: Thu Feb 17, 2011 9:50 am

Re: Import a large number of excel files

Postby RDS » Wed Mar 21, 2018 10:20 am

Import is not stable: Eviews crashes.

I continue to prefer read

smpl {%startdate2} {%lastdate}
for %series 1 2 3 4 5 6 7 8 9 10 11 12 13
read(e,c2,s={%series}_) OECD_CLI_EA.xls CLI_{%series}
next

rename cli_1 cli_AT
rename cli_2 cli_BE
rename cli_3 cli_DE
rename cli_4 cli_EA
rename cli_5 cli_ES
rename cli_6 cli_FI
rename cli_7 cli_FR
rename cli_8 cli_GR
rename cli_9 cli_IE
rename cli_10 cli_IT
rename cli_11 cli_NL
rename cli_12 cli_PT
rename cli_13 cli_US

EViews Steve
EViews Developer
Posts: 504
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Import a large number of excel files

Postby EViews Steve » Wed Mar 21, 2018 4:35 pm

What version of EViews are you using? And the build date? Mind posting one of your spreadsheets?

Nom
Posts: 3
Joined: Mon Feb 26, 2018 4:46 am

Re: Import a large number of excel files

Postby Nom » Tue Mar 27, 2018 3:51 am

EViews Steve wrote:
Nom wrote:Hi, I'm sorry I am not answering your question but I want to ask for your help. I am a new user on this forum and I would like to post up a question but I do not know how or where to do this. Where do I click? Which icon? Thank you


Once you've entered a forum group page (such as this Programming group), simply click the "New Topic*" button. It looks like this:

new_topic.png
Steve


thank you Steve


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest