Help on script to import multiple TXT files and removing certain data JMP 15Hello,
I would like to import a number of TXT files into one data table.
An individual TXT file looks like this and I would like to only import the highlighted data and if possible create a new column to capture the batch number.

I’ve written the following script (below) which gets me partially there but I still have to delete some of the data as highlighted below. This is ok when I only have a few files but when there are more than 10 it’s a problem.

Can anyone recommend an addition to the script to resolve this issue? I'm currently using JMP 15.
Thank you!
Multiple File Import(
<<SET folder=""></SET>
Data TableScriptingRe: Help on script to import multiple TXT files and removing certain data JMP 15Hi @ClaireatBH,
In addition to your Multiple File Import code, the JSL below should do the trick. It was mostly put together with the enhanced log in JMP 16, just released yesterday.
Kind Regards,
Ben
</CODE></P>
<PRE><CODE class=" language-jsl">// Setup and point to open data table
Names Default to Here(1);
dt = Current Data Table();
// Highlight Batch# rows
dt << Select Where( :Column 1 == "Batch#" );
// Make a subset of Batch# rows
dt_batch = dt << Subset( Output Table( "Batch Numbers" ), Selected Rows( 1 ), selected columns( 0 ) );
// Change name in subset so doesn't overwrite when joined back onto
dt_batch:Time << Set Name("Batch No");
// Delete unwanted rows
dt << Select Where( Is Missing( :V 2 ) ) << Delete Rows;
// Pull Batch No into main table
dt << Update(
With( dt_batch ),
Match Columns( :File Name = :File Name ),
Add Columns from Update Table( :Batch No ),
Replace Columns in Main Table( None )
);
// Close subset with Batch No
Close(dt_batch, nosave)
// Move selected column: Batch No
Data Table( "SAS_TEST_FILE_FROM_1_SAS_TEST_FILE_FROM_3" ) <<
Move Selected Columns( {:Batch No}, after( :Column 1 ) );
// Delete column: Column 1
Data Table( "SAS_TEST_FILE_FROM_1_SAS_TEST_FILE_FROM_3" ) <<
Delete Columns( :Column 1 );
Re: Help on script to import multiple TXT files and removing certain data JMP 15@benfrancis That works perfectly. Thank you for your help!