Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This uses a library I wrote and released under the GPLv3 License: <a href="https://github.com/DrPaulBrewer/html5csv" rel="nofollow">html5csv</a></p> <p>The example below uploads a CSV file into the browser, where it is available as an array of arrays. </p> <p>The library supports various block operations, such as make a table, edit, plot, fit, call a function, save in browser session storage or local storage. </p> <p><a href="http://jsfiddle.net/DrPaulBrewer/nrAtj/" rel="nofollow">JSFIDDLE</a></p> <p>html</p> <pre><code>Choose a CSV file to load into the application: &lt;input id='foo' type='file'&gt; &lt;hr /&gt; </code></pre> <p>js (requires jQuery and html5csv.js)</p> <pre><code>CSV.begin('#foo'). table('output', {header:1, caption:'Uploaded CSV Data'}). go(); </code></pre> <p>Here, <code>go()</code> can take a function <code>callback (e,D)</code>, where e will contain an error string or null, and D is an object that may contain <code>D.rows[0][0],...,D.rows[n-1][m-1]</code> for a <code>n x m</code> matrix of data. Row 0 may be a header row. </p> <p>Asynchronicity is used, in fact enforced in places. So beware that like AJAX, this code will return immediately to the subsequent line, and is best read as setting up a workflow of what to do when the previous step becomes ready.</p> <p><strong>Saving/Restoring</strong></p> <p>You can save data into the user's browser localStorage object with <code>.save('local/someKey').</code> somewhere in the workflow, and data existing in the array at that point will be stored in HTML5 local storage (perhaps even compressed if you include the LZString library as documented), until the browser user deletes it. </p> <p>Then in the same page or another page on the same web site you can get the data back out with <code>CSV.begin('local/someKey')...</code></p> <p><strong>Using the data</strong></p> <p>You should put any code you want to use the data into a function that can fit either the callbacks expected by html5csv's <code>call</code> or <code>go</code> as documented on the html5csv site.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload