example script to upload any csv and run sql queries against the data in the browser
✓ Published0🌍 Public
Aandrewfulrich
Last edited Feb 11, 2018
Created on Feb 11, 2018
This example loads a user-selected CSV file through an HTML file input and stores its contents in an in-browser SQL database using the sql.js library, which compiles SQLite to JavaScript. It infers each column’s data type—integer, float, boolean, date, or text—from the first non-empty value, then dynamically creates a table and inserts rows. After import, the code runs a sample SQL query with a bound parameter (e.g., counting rows by a last name) and logs the result to the console, demonstrating how to execute arbitrary SQL against uploaded tabular data entirely client-side.
AI-generated description