cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
tsolomon
Level III

How do you open multiple files and specify what the column names are for the files?

I found this script which opens multiple files but the columns in the files don't have a header and this script automatically converts the first row into column names. Do you know how to modify this to specify the first row is not the column names and specify the column names for each file if the names are all the same?

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: How do you open multiple files and specify what the column names are for the files?

The 'Open()' command is very versatile, so has many options. Select 'Help > Scripting Index', type 'Open' in the search field at the upper left, and look for 'Open()' in the Items list. You can then inspect and run some examples. Example 2 contains the option 'Table Contains Column Headers( 0 )' which seems to be what you want.

View solution in original post

4 REPLIES 4
tsolomon
Level III

Re: How do you open multiple files and specify what the column names are for the files?

Here is the script to open multiple files that I found on another posting.

Set Default Directory( "C:\Jan_24th\" );

files = Files In Directory( "C:\Jan_24th\" );

For( i = 1, i <= N Items( files ), i++,

          If( Ends With( files[i], ".csv" ),

                    Open( files[i] );

                    Text Box( Regex( files[i], "(.+?)_", "\1" ) ) << journal; // All text before first "_" in file i's name is journaled

          )

);

msharp
Super User (Alumni)

Re: How do you open multiple files and specify what the column names are for the files?

This is a JMP preference.  Go to File >> Preferences (ctrl+k) and uncheck the box. 

10288_pastedImage_0.png

Similarly you can can script this with:

Set Preferences(Import Settings(Labels(0))) //off

Set Preferences(Import Settings(Labels(1))) //on

Be sure to turn the preference back on when you are done or else you are going to annoy your end user.

ian_jmp
Level X

Re: How do you open multiple files and specify what the column names are for the files?

The 'Open()' command is very versatile, so has many options. Select 'Help > Scripting Index', type 'Open' in the search field at the upper left, and look for 'Open()' in the Items list. You can then inspect and run some examples. Example 2 contains the option 'Table Contains Column Headers( 0 )' which seems to be what you want.

tsolomon
Level III

Re: How do you open multiple files and specify what the column names are for the files?

Thank you, this worked great!