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

Automate importing files

I have imported an excel file using workflow and am editing the script to be more general. Within the import settings under Column names starts is a specific number but instead I want it to be when a specific condition is met (e.g. when row 5 column 2 says START with start being the column name). 

Any help in the right direction is very appreciated.

 

The snippet of code is below with the important function in bold:

Import Settings(
	End Of Line( CRLF, CR, LF ),
	End Of Field( Comma, CSV( 0 ) ),
	Strip Quotes( 1 ),
	Use Apostrophe as Quotation Mark( 0 ),
	Use Regional Settings( 0 ),
	Scan Whole File( 1 ),
	Treat empty columns as numeric( 0 ),
	CompressNumericColumns( 0 ),
	CompressCharacterColumns( 0 ),
	CompressAllowListCheck( 0 ),
	Labels( 1 ),
	Column Names Start( 263 ),
	First Named Column( 1 ),
	Data Starts( 264 ),
	Lines To Read( "All" ),
	Year Rule( "20xx" )
)
2 REPLIES 2
jthi
Super User

Re: Automate importing files

It might be easier to import the whole file and perform the data cleanup in JMP after the import (of course depending on your data).

-Jarmo
txnelson
Super User

Re: Automate importing files

Here is some pseudo code that might give you a leg up on a possible methodology to use

dt = Open(<Excel File>);

// Get the first row where the second column has the word START
headerRow = dt << get rows where( contains( as column(2), "START" )[1];
dataRow = headerRow + 1;

// Close the data table
close(dt, nosave);

// Substitute into the full Excel Import Settings the the header row number and 
// the data row number and run the code
Eval(
	Substitute(
		Expr(
dt = Open(.........
	Column Names Start( _H_ ),
	First Named Column( 1 ),
	Data Starts( _S_ ),
	......................);
		
		),
	expr( _H_ ), headerRow,
	expr( _S_ ), dataRow
	)
);

 

Jim