cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
AT
AT
Level V

Merge CSV in JMP 13

Hi,

I like to merge few CSV files in a given directory. The files are similar format but also like to skip few lines after the headers and keep just the header for the first file. Once the files are merged, I can do the analysis on the merged file. I checked the JMP community, and did not find the best solution. I appreciate your help in providing me a script that do this. Thanks.

16 REPLIES 16
AT
AT
Level V

Re: Merge CSV in JMP 13

Thanks. I am trying to make csv merge for JMP13 and it is great to hear that JMP14 can handle this. It is time to upgrade!!

AT
AT
Level V

Re: Merge CSV in JMP 13

Thanks all for your great support. I also like to be able to pick the directory and select individual csv files instead of slecting all csv files in the directory. I am using the script written by Byron (JMP) and have attached here. It works perfectly but if someone can help me to be able to select individual csv files, that would be very helpful. Thanks

txnelson
Super User

Re: Merge CSV in JMP 13

In the Scripting Index you will find the definition and an example of using Pick File().  This will allow you to select files.

Jim
AT
AT
Level V

Re: Merge CSV in JMP 13

Thanks Jim. I used Pick File() but I need the file names only not the fullpath/file name information. Is there a way to get file name instead?

 

 

prefilelist = Pick File(
"Select JMP File",
"",
{"JMP Files|jmp;jsl;csv", "All Files|*"},
1,
0,
"",
multiple // save flag is 0, allows multiple file selection
);

show(prefilelist);

 

 

Thanks for continuous support.

txnelson
Super User

Re: Merge CSV in JMP 13

1. I very strongly suggest that you read the Scripting Guide......you need to get a review of the different items available in JSL.......

The solution to what you requested is to simply strip off the filename from the end of the complete path.  In JSL, there are all kinds of character handling functions.  See:

     Help==>Scripting Index==>Functions==>Character

Specifically, you need to use the Word() function

completefilename = "/C:/Users/txjim/Parameter Ranking/Parameter Ranking_v8 with private.jsl";
filename = Word( -1, completefilename, "/" );
show( filename );

filename has the value, "Parameter Ranking_v8 with private.jsl"

Jim
AT
AT
Level V

Re: Merge CSV in JMP 13

Thanks Jim. I was reading mostly on Pick File() and thought there is a way to do that. I will try your suggestion and let you know. Thanks again.

AT
AT
Level V

Re: Merge CSV in JMP 13

Thanks Jim. I was able to get it to work using Word() function. Thanks for all your support.