<?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 Can I get a list of sheets in an Excel workbook ? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/824975#M100478</link>
    <description>&lt;P&gt;Seriously? &amp;nbsp;How did I not know about this. &amp;nbsp;Thanks, though, very helpful!&lt;/P&gt;</description>
    <pubDate>Mon, 23 Dec 2024 18:32:57 GMT</pubDate>
    <dc:creator>MathStatChem</dc:creator>
    <dc:date>2024-12-23T18:32:57Z</dc:date>
    <item>
      <title>How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4472#M4472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a situation where I am opening Excel sheets using Open Database().&lt;/P&gt;&lt;P&gt;This has been a good way to do it since I want specific columns from specific sheets, so using an SQL SELECT statement is ideal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am now discovering there is no standardization on the sheet names. So what I want to do is query the Excel workbook and get a list of sheets in it. I can then use some logic in my code to decide which ones I actually want ( because while there is no standardization, there are enough "similarities" that I could figure out what I want, by checking does the sheet name contain StringA or StringB or StringC for example ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have no idea how this can be done in JSL. Searching onling, there are plenty of code examples using VBScripting etc which will return the sheets in an Excel workbook, but that is not much help.&lt;/P&gt;&lt;P&gt;I tried also to find some SQL statement that would do it, but I don't know of a table name that would list the "tables"&amp;nbsp; / sheets in the workbook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know JMP can do it because if I use File -&amp;gt; DataBase -&amp;gt; Open Table and connect to an Excel data source it will list all the sheets available in the Schemas - Tables column. Likewise if I set a user preference to select individual Excel Worksheets and use the Open() command it will ask me to select which sheets I want to open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my question is does anybody know if JMP exposes that capability to figure out the Excel sheet names to the scripting language ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 21:57:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4472#M4472</guid>
      <dc:creator>tsl</dc:creator>
      <dc:date>2012-02-23T21:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4473#M4473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a very clunky way which may not even be feasible if the tables are very large. Just a fragment ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Set preferences to open all Excel sheets on file&amp;gt;open.&lt;/P&gt;&lt;P&gt;2. countBefore = N Table();&lt;/P&gt;&lt;P&gt;3. Open the Excel file using open()&lt;/P&gt;&lt;P&gt;4. countAfter = N Table();&lt;/P&gt;&lt;P&gt;5. nSheets = countAfter - countBefore&lt;/P&gt;&lt;P&gt;5. dtname = {};&lt;/P&gt;&lt;P&gt;5. for(i=1, i &amp;lt;= nSheets, i++, dtname&lt;I&gt; = Data Table(i) &amp;lt;&amp;lt; get name);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then dtname is a list of Sheet names you can play with and you can close the tables you don't want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: mpb&#xD;&lt;BR /&gt;Corrected indexing in the code fragment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 20:46:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4473#M4473</guid>
      <dc:creator>mpb</dc:creator>
      <dc:date>2012-02-24T20:46:31Z</dc:date>
    </item>
    <item>
      <title>How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4474#M4474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note that the code fragment above was corrected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Mar 2012 00:50:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4474#M4474</guid>
      <dc:creator>mpb</dc:creator>
      <dc:date>2012-03-02T00:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4475#M4475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The last step may get you messed up if you have data tables open before you open the excel worksheets.&amp;nbsp; Quick correction is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; for(i=1, i &amp;lt;= nSheets, i++, dtname&lt;I&gt; = Data Table(i&lt;STRONG&gt;+countBefore&lt;/STRONG&gt;) &amp;lt;&amp;lt; get name);&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 16:22:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/4475#M4475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-07T16:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/824518#M100410</link>
      <description>&lt;P&gt;This is an old thread, but found it useful. &amp;nbsp;Here is a script that will do this by opening the contents of the XLSX file directly. &amp;nbsp;XLSX files are simply ZIP files with a collection of XML files that define the properties, structure, and elements of the workbook. &amp;nbsp;&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 );

filename = pick file("Choose Excel File", "$DOCUMENTS", {"Excel Files|xlsx"} );

zipxlsx = Open( filename, Zip );

zip_file = zipxlsx &amp;lt;&amp;lt; read( "xl/workbook.xml", Format( blob ) );

// Open the file
zz = Open(
	zip_file,
	invisible,
	xml,
	XML Settings(
		Stack( 0 ),
		Row( "/workbook/sheets/sheet" ),
		Col(
			"/workbook/sheets/sheet/@name",
			Column Name( "name" ),
			Fill( "Use Once" ),
			Type( "Character" ),
			Format( {"Best"} ),
			Modeling Type( "Nominal" )
		)
	)
);

worksheets=(zz:name &amp;lt;&amp;lt; get values);      

close(zz, nosave);

write(worksheets);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Dec 2024 17:27:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/824518#M100410</guid>
      <dc:creator>MathStatChem</dc:creator>
      <dc:date>2024-12-19T17:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/824570#M100416</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mmarchandFSLR_0-1734644675003.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71433iF8AF77A9D7A29848/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mmarchandFSLR_0-1734644675003.png" alt="mmarchandFSLR_0-1734644675003.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 21:44:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/824570#M100416</guid>
      <dc:creator>mmarchandFSLR</dc:creator>
      <dc:date>2024-12-19T21:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/824975#M100478</link>
      <description>&lt;P&gt;Seriously? &amp;nbsp;How did I not know about this. &amp;nbsp;Thanks, though, very helpful!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 18:32:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/824975#M100478</guid>
      <dc:creator>MathStatChem</dc:creator>
      <dc:date>2024-12-23T18:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I get a list of sheets in an Excel workbook ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/825057#M100486</link>
      <description>&lt;P&gt;How did you not know about that.....because you are human.&amp;nbsp; No one can know everything in JMP and then every 18 months or so, a plethora of new features and functions come out in a new release.&amp;nbsp; Personally, I learn so much from you and your contributions on sooooooo many things in JMP that I do not know, or no longer remember.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2024 03:07:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-Can-I-get-a-list-of-sheets-in-an-Excel-workbook/m-p/825057#M100486</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-12-24T03:07:27Z</dc:date>
    </item>
  </channel>
</rss>

