Skip to content

Commit

Permalink
Support ?csv=URL to load remote csv
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Feb 15, 2023
1 parent 8e5f476 commit cc5969e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ export default function App() {
const [tableData, setTableData] = React.useState([]);

React.useEffect(() => {
Papa.parse("/zarr_samples.csv", {

const params = new URLSearchParams(location.search);
let csvUrl = params.get("csv");
try {
new URL(csvUrl);
} catch (error) {
csvUrl = "/zarr_samples.csv";
}
Papa.parse(csvUrl, {
header: true,
download: true,
complete: function (results) {
Expand Down

0 comments on commit cc5969e

Please sign in to comment.