<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to write scripts to automatically read many csv files and automatically save graphs to a specified directory in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532647#M75555</link>
    <description>&lt;OL&gt;
&lt;LI&gt;See the Multiple File Import() function in the Scripting Index&lt;/LI&gt;
&lt;LI&gt;You are handling this section&lt;/LI&gt;
&lt;LI&gt;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?&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Thu, 11 Aug 2022 00:39:30 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-08-11T00:39:30Z</dc:date>
    <item>
      <title>How to write scripts to automatically read many csv files and automatically save graphs to a specified directory</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532369#M75537</link>
      <description>&lt;P class=""&gt;Hello, I need help.&lt;/P&gt;&lt;P class=""&gt;I'm using JMP 16 and would like to write scripts to automatically complete the following tasks. Files come from laboratory .&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;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;&lt;/P&gt;&lt;P class=""&gt;2,After importing data and data editing &amp;amp; creating graphs,each worksheet generates 2 different graphs (for example, called graph A, B).I can handle this section.&lt;/P&gt;&lt;P class=""&gt;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&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;500 csv files are saved to the folders C,D.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Section 1&amp;amp;3 are very difficult for me.Hope to give some script examples and any guidance is much appreciated.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:07:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532369#M75537</guid>
      <dc:creator>fredwcf</dc:creator>
      <dc:date>2023-06-09T17:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to write scripts to automatically read many csv files and automatically save graphs to a specified directory</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532647#M75555</link>
      <description>&lt;OL&gt;
&lt;LI&gt;See the Multiple File Import() function in the Scripting Index&lt;/LI&gt;
&lt;LI&gt;You are handling this section&lt;/LI&gt;
&lt;LI&gt;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?&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 11 Aug 2022 00:39:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532647#M75555</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-11T00:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to write scripts to automatically read many csv files and automatically save graphs to a specified directory</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532890#M75567</link>
      <description>&lt;P&gt;Hi,txnelson,&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;3、The&amp;nbsp;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;A href="https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532369#" target="_blank" rel="noopener"&gt;PREVIEW&lt;/A&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Aug 2022 11:29:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/532890#M75567</guid>
      <dc:creator>fredwcf</dc:creator>
      <dc:date>2022-08-11T11:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to write scripts to automatically read many csv files and automatically save graphs to a specified directory</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/533047#M75585</link>
      <description>&lt;P&gt;Here is a mock up of a method that can be used to do what you want.&amp;nbsp; 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&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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 = "&amp;lt;Path to the folder the Excel files are in &amp;gt;";

For( i = 1, i &amp;lt; 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), &amp;lt;&amp;lt;journal);
	j2 = New Window("The Name " || char(i), &amp;lt;&amp;lt;journal);
	
	// Move graph to be saved to the C folder to j1
	j1 &amp;lt;&amp;lt; journal( the display object for the graph);
		
	// Move graph to be saved to the D folder to j2
	j2 &amp;lt;&amp;lt; journal( the display object for the graph);
	
	// Save the file
	j1 &amp;lt;&amp;lt; save journal("path and filename.jrn");
	jd &amp;lt;&amp;lt; save journal("path and filename.jrn");
	
	// Delete the various files from this iteration
	j1 &amp;lt;&amp;lt; close window;
	j2 &amp;lt;&amp;lt; close window;
	close( dt1, nosave );
	// close the graph window
	// close the report window
);
	&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Aug 2022 15:26:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-scripts-to-automatically-read-many-csv-files-and/m-p/533047#M75585</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-11T15:26:58Z</dc:date>
    </item>
  </channel>
</rss>

