cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
TDK_Long
Level III

How to import 30 Excel files without opening the data tables?

Hi folks,

 

I am using JMP scripts to import the data of 30 Excel files. When I run it, there will be 30 data tables opened during the "Open" action. So I have to manually close each of these 30 data tables, which is very tedious. Is there a way that I can read / import the data from Excel without opening the data table so that I do not need to close the data table one by one? Your comments / suggestions are much appreciated. 

 

For example:

Names Default To Here( 1 );
dt01 = Open( "$SAMPLE_DATA/Big Class01.jmp" );
dt02 = Open( "$SAMPLE_DATA/Big Class02.jmp" );
dt03 = Open( "$SAMPLE_DATA/Big Class03.jmp" );
dt04 = Open( "$SAMPLE_DATA/Big Class04.jmp" );
dt05 = Open( "$SAMPLE_DATA/Big Class05.jmp" );
dt06 = Open( "$SAMPLE_DATA/Big Class06.jmp" );

 

....

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to import 30 Excel files without opening the data tables?

It is pretty simple to handle multiple open files that need to be closed.  Below is an expansion on your example, that opens the data tables, without having them visible, and then closing them when the activity with them is complete.

Names Default To Here( 1 );
dList = {};

dt01 = Open( "$SAMPLE_DATA/Big Class01.jmp", invisible );
Insert Into( dList, "dt01" );
dt02 = Open( "$SAMPLE_DATA/Big Class02.jmp", invisible );
Insert Into( dList, "dt02" );
dt03 = Open( "$SAMPLE_DATA/Big Class03.jmp", invisible );
Insert Into( dList, "dt03" );
dt04 = Open( "$SAMPLE_DATA/Big Class04.jmp", invisible );
Insert Into( dList, "dt04" );
dt05 = Open( "$SAMPLE_DATA/Big Class05.jmp", invisible );
Insert Into( dList, "dt05" );
dt06 = Open( "$SAMPLE_DATA/Big Class06.jmp", invisible );
Insert Into( dList, "dt06" );

// When ready to close them
For Each( {dt, i}, dList,
	Close( Eval( Parse( dList[i] ) ), nosave )
);

Rather than using the "Invisible" option, the "Private" option can be used, and then the data table is not visible in the Home Window.

 

If you want to provide this capability in an interactive mode, you can open all of the data tables, and then using the Home Window, you can highlight all of the data table you want to close, and the right click, and select "Close".  JMP will ask is you want to Save the data tables, and you can select "Save None" and it will then close all of the highlighted data tables all at once.

Jim

View solution in original post

6 REPLIES 6
WebDesignesCrow
Super User

Re: How to import 30 Excel files without opening the data tables?

To close the 30 files, you can script the close action as well;

Close (dt01);

Close (dt02);

Close (dt03);

......

 

txnelson
Super User

Re: How to import 30 Excel files without opening the data tables?

It is pretty simple to handle multiple open files that need to be closed.  Below is an expansion on your example, that opens the data tables, without having them visible, and then closing them when the activity with them is complete.

Names Default To Here( 1 );
dList = {};

dt01 = Open( "$SAMPLE_DATA/Big Class01.jmp", invisible );
Insert Into( dList, "dt01" );
dt02 = Open( "$SAMPLE_DATA/Big Class02.jmp", invisible );
Insert Into( dList, "dt02" );
dt03 = Open( "$SAMPLE_DATA/Big Class03.jmp", invisible );
Insert Into( dList, "dt03" );
dt04 = Open( "$SAMPLE_DATA/Big Class04.jmp", invisible );
Insert Into( dList, "dt04" );
dt05 = Open( "$SAMPLE_DATA/Big Class05.jmp", invisible );
Insert Into( dList, "dt05" );
dt06 = Open( "$SAMPLE_DATA/Big Class06.jmp", invisible );
Insert Into( dList, "dt06" );

// When ready to close them
For Each( {dt, i}, dList,
	Close( Eval( Parse( dList[i] ) ), nosave )
);

Rather than using the "Invisible" option, the "Private" option can be used, and then the data table is not visible in the Home Window.

 

If you want to provide this capability in an interactive mode, you can open all of the data tables, and then using the Home Window, you can highlight all of the data table you want to close, and the right click, and select "Close".  JMP will ask is you want to Save the data tables, and you can select "Save None" and it will then close all of the highlighted data tables all at once.

Jim
TDK_Long
Level III

Re: How to import 30 Excel files without opening the data tables?

Thanks, Jim. Very nice.

Craige_Hales
Super User

Re: How to import 30 Excel files without opening the data tables?

Take a look at Multiple File Import. MFI can load similar external files into a single JMP data table.

Import all the xlsx files from a directory.Import all the xlsx files from a directory.

You can save (and modify) the script to re-import again.

Craige
TDK_Long
Level III

Re: How to import 30 Excel files without opening the data tables?

Thank you Craige. 

Re: How to import 30 Excel files without opening the data tables?

You must import data into a data table. I assume you want to avoid the tedium of opening and closing individual files. Have you tried the Multiple File Import feature?