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

Open Multiple files in different folders

I have experimental results in 2 different formats as excel files under different folders depending on the conditions of the experiment. Is there a way for the user to state the parent directory and then JMP will open all the excel files as data tables?

I also need need to be able to state the row the data starts on depending on which format the file is so that the column names are correct.

 

I have tried using workflow but I'm not able to use it for more than 1 file and I have tried the importing multiple files function but this only allows access in to 1 folder.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Open Multiple files in different folders

Here is a beginning script that does what you want.  It should give you a good start on developing a robust script.

Names Default To Here( 1 );

// Find the top directory to get the xlsx files from
path = Pick Directory();

// Read in all of the file names
allFiles = Files In Directory( path, recursive( 1 ) );

// Create a list of just the xlsx files
xlsxFiles = {};
For Each( {file}, allFiles,
	If( Word( -1, file, "." ) == "xlsx",
		Insert Into( xlsxFiles, file )
	)
);

// Open each of the xlsx files one after another
// using the Excel Wizard
For Each( {file, i}, xlsxFiles,
	Open( path || xlsxFiles[i], "excel wizard" )
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Open Multiple files in different folders

Here is a beginning script that does what you want.  It should give you a good start on developing a robust script.

Names Default To Here( 1 );

// Find the top directory to get the xlsx files from
path = Pick Directory();

// Read in all of the file names
allFiles = Files In Directory( path, recursive( 1 ) );

// Create a list of just the xlsx files
xlsxFiles = {};
For Each( {file}, allFiles,
	If( Word( -1, file, "." ) == "xlsx",
		Insert Into( xlsxFiles, file )
	)
);

// Open each of the xlsx files one after another
// using the Excel Wizard
For Each( {file, i}, xlsxFiles,
	Open( path || xlsxFiles[i], "excel wizard" )
);
Jim