cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
pgkla
Level I

Apply JSL script to multiple sheets from excel

So I have an excel file with multiple sheets that have the same kind of dataframe (just different values) in each of the sheets. I was able to export a script for "Fit Y by X"

Open();

Fit Group(
	Bivariate( Y( :Total_Cost ), X( :LGP1 ), Automatic Recalc( 1 ) ),
	Bivariate( Y( :Total_Cost ), X( :iteration ), Automatic Recalc( 1 ) ),
	Bivariate( Y( :LGP2 ), X( :LGP1 ), Automatic Recalc( 1 ) ),
	Bivariate( Y( :LGP2 ), X( :iteration ), Automatic Recalc( 1 ) ),
	<<{Arrange in Rows( 2 )}
)

I'm using this script to call from python using subprocess.call([<path to jmp.exe>, <jsl_script_filepath>]).
When I execute the python code, I select my excel file and the script is being applied to only the first sheet whereas I want it to apply on all the sheets. Could someone help how I can achieve that? 

I'm using JMP14 and python3 to do the above. 

1 REPLY 1
txnelson
Super User

Re: Apply JSL script to multiple sheets from excel

If the

Open(); 

is opening all of the sheets, then the below should do what you want.

names default to here( 1 );
Open();
For( i = 1, i <= N Table(), i++,
	Data Table( i ) << Fit Group(
		Bivariate( Y( :Total_Cost ), X( :LGP1 ), Automatic Recalc( 1 ) ),
		Bivariate( Y( :Total_Cost ), X( :iteration ), Automatic Recalc( 1 ) ),
		Bivariate( Y( :LGP2 ), X( :LGP1 ), Automatic Recalc( 1 ) ),
		Bivariate( Y( :LGP2 ), X( :iteration ), Automatic Recalc( 1 ) ),
		<<{Arrange in Rows( 2 )}
	)
);
Jim

Recommended Articles