<?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: Include file name in excel import in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/443147#M69126</link>
    <description>&lt;P&gt;Thank you for this solution.&lt;/P&gt;&lt;P&gt;I had a similar issue and needed to put it in a loop to open multiple excel files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
path = Pick Directory( "Select a directory" );
file_list = Files In Directory(path, recursive);

for(i = 1, i &amp;lt;= N Items(file_list), i++,
filename = path||file_list[i];

dt = Open(
	filename,
	Worksheets( "Sheet1" ),
	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( 41 ),
		Data Starts on Row( 42 ),
		Data Starts on Column( 1 ),
		Data Ends on Row( 54 ),
		Data Ends on Column( 20 ),
		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( "-" )
	)
);
dt &amp;lt;&amp;lt; New Column ("Filename", Character, "Nominal", &amp;lt;&amp;lt; Set Each Value(Word(-1, file_list[i], "/")));

);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Dec 2021 20:17:04 GMT</pubDate>
    <dc:creator>mlo1</dc:creator>
    <dc:date>2021-12-07T20:17:04Z</dc:date>
    <item>
      <title>Include file name in excel import</title>
      <link>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/388194#M63830</link>
      <description>&lt;P&gt;Is there a way to include a column with the file name on an imported excel table? Using the multiple file import tool there is an option to include this, but I haven't found the equivalent when importing a singular file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried using get path/get name and then writing that to a column but that just gives me "Sheet1.jmp".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Open command I used was copied from the wizard:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtt.file= Pick File(); // Opens File dialogue

Open(
	dtt.file,
	Worksheets( "Sheet1" ),
	Use for all sheets( 1 ),
	Concatenate Worksheets( 0 ),
	Create Concatenation Column( 0 ),
	Worksheet Settings(
		1,
		Has Column Headers( 1 ),
		Number of Rows in Headers( 2 ),
		Headers Start on Row( 1 ),
		Data Starts on Row( 3 ),
		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( "-" )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:30:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/388194#M63830</guid>
      <dc:creator>rickr135</dc:creator>
      <dc:date>2023-06-10T23:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Include file name in excel import</title>
      <link>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/388221#M63832</link>
      <description>&lt;P&gt;Not sure if there are any direct solutions like in Multiple File Import but you can create new column after you have loaded the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below are two ways to do it, one using the picked file path and other using table name (this might be affected by the sheet name):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dtt.file= Pick File(); // Opens File dialogue

dt = Open(
	dtt.file,
	Worksheets( "Sheet1" ),
	Use for all sheets( 1 ),
	Concatenate Worksheets( 0 ),
	Create Concatenation Column( 0 ),
	Worksheet Settings(
		1,
		Has Column Headers( 1 ),
		Number of Rows in Headers( 2 ),
		Headers Start on Row( 1 ),
		Data Starts on Row( 3 ),
		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( "-" )
	);
);
dt &amp;lt;&amp;lt; New Column("Filename", Character, "Nominal", &amp;lt;&amp;lt; Set Each Value(Word(-1, dtt.file, "/")));
dt &amp;lt;&amp;lt; New Column("Filename", Character, "Nominal", &amp;lt;&amp;lt; Set Each Value(dt &amp;lt;&amp;lt; Get Name()));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;See Scripting Index for more information on the functions, especially Word().&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 15:27:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/388221#M63832</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-05-25T15:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Include file name in excel import</title>
      <link>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/388255#M63836</link>
      <description>&lt;P&gt;Thank you! Using the following worked for what I was trying to accomplish:&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;dt &amp;lt;&amp;lt; New Column("Filename", Character, "Nominal", &amp;lt;&amp;lt; Set Each Value(Word(-1, dtt.file, "/")));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 17:34:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/388255#M63836</guid>
      <dc:creator>rickr135</dc:creator>
      <dc:date>2021-05-25T17:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Include file name in excel import</title>
      <link>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/443147#M69126</link>
      <description>&lt;P&gt;Thank you for this solution.&lt;/P&gt;&lt;P&gt;I had a similar issue and needed to put it in a loop to open multiple excel files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
path = Pick Directory( "Select a directory" );
file_list = Files In Directory(path, recursive);

for(i = 1, i &amp;lt;= N Items(file_list), i++,
filename = path||file_list[i];

dt = Open(
	filename,
	Worksheets( "Sheet1" ),
	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( 41 ),
		Data Starts on Row( 42 ),
		Data Starts on Column( 1 ),
		Data Ends on Row( 54 ),
		Data Ends on Column( 20 ),
		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( "-" )
	)
);
dt &amp;lt;&amp;lt; New Column ("Filename", Character, "Nominal", &amp;lt;&amp;lt; Set Each Value(Word(-1, file_list[i], "/")));

);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Dec 2021 20:17:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Include-file-name-in-excel-import/m-p/443147#M69126</guid>
      <dc:creator>mlo1</dc:creator>
      <dc:date>2021-12-07T20:17:04Z</dc:date>
    </item>
  </channel>
</rss>

