<?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: import csv with two rows as header in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/import-csv-with-two-rows-as-header/m-p/355970#M60584</link>
    <description>&lt;P&gt;You might try multiple file import, even for just one file. Might be faster, and supports multiple line headers.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="File-&amp;gt;Import Multiple Files" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30014iA63574E41E3343B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="File-&amp;gt;Import Multiple Files" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;File-&amp;gt;Import Multiple Files&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 15:04:37 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2021-02-04T15:04:37Z</dc:date>
    <item>
      <title>import csv with two rows as header</title>
      <link>https://community.jmp.com/t5/Discussions/import-csv-with-two-rows-as-header/m-p/355843#M60578</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with relative large csv files (±150MB), The files start with two rows that need to be combined as the column header.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a script that loop through each column and set the column name to the current name + the value of the first row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem it is running very slow, sometimes I need to wait ±10min for changing the name of 4000 columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is somehow depends on the file size, changing the same amount of column in a small file takes few seconds.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried few workarounds -&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. subset only the first row and changing all column names (very fast). I then thought I'll concatenate the original table, but I can't do it because the column names now are not same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. updating the CSV import setting as suggested &lt;A href="https://community.jmp.com/t5/Discussions/Import-csv-file-using-specified-row-as-column-names/td-p/243581" target="_self"&gt;here&lt;/A&gt;. but I still don't see an option to include two rows as header.&lt;/P&gt;&lt;P&gt;3. export the file as xls and then import it with two rows as header. the export time is longer than the original column name change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another workaround that I'm missing, maybe there is an option to change all column names based on a list?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the helpers.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:25:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/import-csv-with-two-rows-as-header/m-p/355843#M60578</guid>
      <dc:creator>Rans</dc:creator>
      <dc:date>2023-06-10T23:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: import csv with two rows as header</title>
      <link>https://community.jmp.com/t5/Discussions/import-csv-with-two-rows-as-header/m-p/355900#M60580</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/22196"&gt;@Rans&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you open the file with JMP and deselct the box "Use default program to open. Uncheck to open as text." and then select the radio button "Data (Using Preview)"; be sure to select all files (*.*) in the JMP open window.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiedrichSchmidt_0-1612445487639.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30003iA921E933D8E3A627/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiedrichSchmidt_0-1612445487639.png" alt="DiedrichSchmidt_0-1612445487639.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can then select some of the important delimiters and other things, including which row the data starts, so if there are two rows as headers, you would skip one and then set the data starts to line 3 or whatever it is.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiedrichSchmidt_1-1612445585367.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30004i0DE3973E8DE9311E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiedrichSchmidt_1-1612445585367.png" alt="DiedrichSchmidt_1-1612445585367.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can then open up the "Source" script in the data table and edit the Import settings as needed and use this script in your JSL program.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiedrichSchmidt_2-1612445652532.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30005i14BA309E9C48A9CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiedrichSchmidt_2-1612445652532.png" alt="DiedrichSchmidt_2-1612445652532.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Alternatively, if you can re-save it as an XLSX file, then you can use the Open() command and define which tab to open, which column to start/stop with, and which row to start/stop with as well as having multiple rows as header. That should solve your problem of having to re-name the columns.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiedrichSchmidt_3-1612445814991.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30007i34D0E9FE09AD29A9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiedrichSchmidt_3-1612445814991.png" alt="DiedrichSchmidt_3-1612445814991.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The last option I'd mention is that if you know what the column names and they don't change, then in your script, you can have a list ColNames ={"...", "...",...} with all the correct names in quotations separated by commas in the list. Then, after loading the CSV file, you can run a For Loop to rename each column according to the entries in ColNames. For example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=Current data table();//or whatever your data table name is.
icols=.;//variable to count through the columns
For(icols=1, icols&amp;lt;=N Columns(dt), icols++,
Column(dt, icols) &amp;lt;&amp;lt;Set Name(ColNames[icols]) //this sets the column name to the "icols-th" entry of the list ColNames
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope one of these helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 13:42:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/import-csv-with-two-rows-as-header/m-p/355900#M60580</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2021-02-04T13:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: import csv with two rows as header</title>
      <link>https://community.jmp.com/t5/Discussions/import-csv-with-two-rows-as-header/m-p/355970#M60584</link>
      <description>&lt;P&gt;You might try multiple file import, even for just one file. Might be faster, and supports multiple line headers.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="File-&amp;gt;Import Multiple Files" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30014iA63574E41E3343B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="File-&amp;gt;Import Multiple Files" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;File-&amp;gt;Import Multiple Files&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 15:04:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/import-csv-with-two-rows-as-header/m-p/355970#M60584</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-02-04T15:04:37Z</dc:date>
    </item>
  </channel>
</rss>

