How to write scripts to automatically read many csv files and automatically save graphs to a specified directoryHello, I need help.
I'm using JMP 16 and would like to write scripts to automatically complete the following tasks. Files come from laboratory .
1, There are 500 csv files (each file contains 1 worksheet), I want scripts, which can automate the reading of worksheets in each csv file;
2,After importing data and data editing & creating graphs,each worksheet generates 2 different graphs (for example, called graph A,
.I can handle this section.
3,The graphs are automatically named, numbered and then saved to 2 different folders (for example, called folders C,D ) at the same file directory.All the graphs of 500 csv files are saved to the folders C,D.
Section 1&3 are very difficult for me.Hope to give some script examples and any guidance is much appreciated.
Thanks.
ScriptingRe: How to write scripts to automatically read many csv files and automatically save graphs to a specified directoryHere is a mock up of a method that can be used to do what you want. There are a lot of specifics that need to added into the script, but for the most part, it should give you a good start
Names Default To Here( 1 );
// Read all the file names
files = Files In Directory( "C:\Users\MyUserName\Documents\My Data\" );
X = N Items( files );
Y = "<PATH to="" the="" folder="" the="" excel="" files="" are="" in="">";
For( i = 1, i < X, i++,
if( right(files[i],4)==".xls",
//open jmp files for each xls files.
dt1 = Open(
Y || files[i],
Worksheets( "my xls worksheet" ),
Use for all sheets( 0 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 0 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 1 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 )
)
);
// edit and build graph for this table
j1 = New Window("The Name " || char(i), <<JOURNAL></JOURNAL></PATH>Re: How to write scripts to automatically read many csv files and automatically save graphs to a specified directoryHi,txnelson,
Thank you very much for your help.
1、You seem to have misunderstood what I meant. I don't mean MFI. I don't want the script to import all these files into one data table at once, but to process one csv file at a time (importing\editing\graph building\saving)and then automatically process the next one.
3、The graphs are with the same name and I want to add both date and number to the name.would you like to give me some examples?
Thanks
Re: How to write scripts to automatically read many csv files and automatically save graphs to a specified directory- See the Multiple File Import() function in the Scripting Index
- You are handling this section
- This is a simple task, if you can specify what the rules are for the naming convention, and where do the numbers come in.....will there be graphs with the same name and you will want to add a number to the name?