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
Agustin
Level IV

How to set row in which data starts based on keyword

Hi, I'm trying to adapt this script:

// Import Excel file: file.xls
// → Data Table( "Results" )
Open(
	"$DESKTOP/JMP test/file.xls",
	Worksheets( "Results" ),
	Use for all sheets( 1 ),
	Concatenate Worksheets( 0 ),
	Create Concatenation Column( 0 ),
	Worksheet Settings(
		1,
		Has Column Headers( 1 ),
		Number of Rows in Headers( 1 ),
		Headers Start on Row( 51 ),
		Data Starts on Row( 52 ),
		Data Starts on Column( 1 ),
		Data Ends on Row( 0 ),
		Data Ends on Column( 0 ),
		Replicated Spanned Rows( 1 ),
		Replicated Spanned Headers( 0 ),
		Suppress Hidden Rows( 1 ),
		Suppress Hidden Columns( 1 ),
		Suppress Empty Columns( 1 ),
		Treat as Hierarchy( 0 ),
		Multiple Series Stack( 0 ),
		Import Cell Colors( 0 ),
		Limit Column Detect( 0 ),
		Column Separator String( "-" )
	)
);

however instead of setting these parameters

		Headers Start on Row( 51 ),
		Data Starts on Row( 52 ),

I would like to check for the keyword "Start" in column 1, the row where "Start" is would be the Headers and the one after would be where the data starts.

Is there an easy way to do this?
I am putting together a script that opens several spreadsheets that are similar and then stacks them, but the row at which the data starts varies from spreadsheet to spreadsheet as they are automatically produced by lab equipment.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to set row in which data starts based on keyword

There is not a "simple" way to do this, however, it is not overly complicated either.

  1. Each table will have to be read twice
    1. First, open the table indicating there is only one column, and it is delimited by the Line Feed character at the end of each line.
  2. Loop through the data table until the word "Start" is found.
    1. Save the Row number
  3. Delete the current data table
  4. Reopen the data table, reading it using your above parameters, with the Header Start and Data Start values set based upon the saved Row Number
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How to set row in which data starts based on keyword

There is not a "simple" way to do this, however, it is not overly complicated either.

  1. Each table will have to be read twice
    1. First, open the table indicating there is only one column, and it is delimited by the Line Feed character at the end of each line.
  2. Loop through the data table until the word "Start" is found.
    1. Save the Row number
  3. Delete the current data table
  4. Reopen the data table, reading it using your above parameters, with the Header Start and Data Start values set based upon the saved Row Number
Jim
Agustin
Level IV

Re: How to set row in which data starts based on keyword

I'm only just starting using JSL and don't really know how to do that. Is there a documentation guide for JSL?

 

txnelson
Super User

Re: How to set row in which data starts based on keyword

The Scripting Guide, which documents JSL(Jmp Scripting Language) is available in the JMP Documentation Library, found under  the Help pull down menu.

Jim