<?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: Is this possible to write a script that opens always the last sheet of an xlsx file? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/531298#M75447</link>
    <description>&lt;P&gt;Here is the example from the Scripting Index that illustrates how to get a list of the spreadsheets that are in a given wookbook.&amp;nbsp; From there one can select the last spreadsheet.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1659923071830.png" style="width: 793px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44627iF4709B6F7EC33AC2/image-dimensions/793x331?v=v2" width="793" height="331" role="button" title="txnelson_0-1659923071830.png" alt="txnelson_0-1659923071830.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
sheetList = Get Excel Worksheets( "$SAMPLE_IMPORT_DATA\Team Results.xlsx" );
Show( sheetList );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From there it is a simple matter to get the last entry in the list&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;lastSheet = sheetList[N Items( sheetList )];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2022 01:47:20 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-08-08T01:47:20Z</dc:date>
    <item>
      <title>Is this possible to write a script that opens always the last sheet of an xlsx file?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/531268#M75441</link>
      <description>&lt;P&gt;I&amp;nbsp;need a JSL script that opens always the last sheet of a chosen xlsx file. Is there a function to do this in JSL?&lt;BR /&gt;Alternatively, is it possible to accomplish this by compiling all the sheets of the Excel file into a list and open the last item of the list? Or open the excel file in a way that the user can input the sheet to open?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:52:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/531268#M75441</guid>
      <dc:creator>jlmbs</dc:creator>
      <dc:date>2023-06-10T23:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is this possible to write a script that opens always the last sheet of an xlsx file?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/531298#M75447</link>
      <description>&lt;P&gt;Here is the example from the Scripting Index that illustrates how to get a list of the spreadsheets that are in a given wookbook.&amp;nbsp; From there one can select the last spreadsheet.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1659923071830.png" style="width: 793px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44627iF4709B6F7EC33AC2/image-dimensions/793x331?v=v2" width="793" height="331" role="button" title="txnelson_0-1659923071830.png" alt="txnelson_0-1659923071830.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
sheetList = Get Excel Worksheets( "$SAMPLE_IMPORT_DATA\Team Results.xlsx" );
Show( sheetList );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From there it is a simple matter to get the last entry in the list&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;lastSheet = sheetList[N Items( sheetList )];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 01:47:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/531298#M75447</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-08T01:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is this possible to write a script that opens always the last sheet of an xlsx file?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/562943#M77602</link>
      <description>&lt;P&gt;This do not seem to be able to work. Here I wrote a code to pick up the xlsx file of interest, of which I would like to get the last worsksheet and open it into a data&amp;nbsp; table. Could you advise on how to move forward from the code below?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;sheetList = Get Excel Worksheets(Pick File(	"Select xlsx file","$DOCUMENTS",{"Excel File|xlsx", "All Files|*"},1,0,""));
Show( sheetList );
lastSheet = sheetList[N Items( sheetList )];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Nov 2022 15:10:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/562943#M77602</guid>
      <dc:creator>jlmbs</dc:creator>
      <dc:date>2022-11-01T15:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is this possible to write a script that opens always the last sheet of an xlsx file?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/562945#M77603</link>
      <description>&lt;P&gt;After you have the name of last sheet and path to the file, then you can use Open() to open the file with only the last worksheet.&lt;/P&gt;
&lt;P&gt;From Scripting Index:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1667315883017.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/46787i13D8193FC1ECC877/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1667315883017.png" alt="jthi_0-1667315883017.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 15:18:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/562945#M77603</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-11-01T15:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is this possible to write a script that opens always the last sheet of an xlsx file?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/562946#M77604</link>
      <description>&lt;P&gt;Your code seems to work for me.&amp;nbsp; What issue are you having with it?&amp;nbsp; What JMP version and what operating system?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 15:29:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/562946#M77604</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-11-01T15:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is this possible to write a script that opens always the last sheet of an xlsx file?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/563186#M77624</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've added a reference to the chosen file, which can then be plugged into Open().&amp;nbsp; Let us know if this works (the Open settings may need to be adjusted for your file):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;sheetList = Get Excel Worksheets(file=Pick File("Select xlsx file","$DOCUMENTS",{"Excel File|xlsx", "All Files|*"},1,0,""));
Show( sheetList );
lastSheet = sheetList[N Items( sheetList )];
Open(
	file,
	Worksheets( lastSheet ),
	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( 1 ),
		Data Starts on Row( 2 ),
		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>Wed, 02 Nov 2022 07:53:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-this-possible-to-write-a-script-that-opens-always-the-last/m-p/563186#M77624</guid>
      <dc:creator>HadleyMyers</dc:creator>
      <dc:date>2022-11-02T07:53:06Z</dc:date>
    </item>
  </channel>
</rss>

