From cc5969ebb3186dda93dcef49c81a49882943fef3 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 15 Feb 2023 17:28:51 +0000 Subject: [PATCH] Support ?csv=URL to load remote csv --- src/App.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index 38afdcf..da51769 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -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) {