# d3.csvParseRow for data via URL?

**URL:** <https://talk.observablehq.com/t/d3-csvparserow-for-data-via-url/2368>\
**Category:** Help\
**Created:** [September 11, 2019, 4:10pm UTC](https://talk.observablehq.com/t/d3-csvparserow-for-data-via-url/2368 "2019-09-11T16:10:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronkyle](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/aaronkyle/32/8106_2.png) [@aaronkyle](https://talk.observablehq.com/u/aaronkyle)\
**Post date:** [September 11, 2019, 4:10pm UTC](https://talk.observablehq.com/t/d3-csvparserow-for-data-via-url/2368/1 "2019-09-11T16:10:15Z")

</div>

I have messy CSV files with several tables. I can drop in the CSV data directly into an observable cell, and then parse it with `d3.csvParseRows` to get what appears to be a more true-to-original array as compared to using `d3.csvParse` [that is, i get arrays composed of 21 object keys (if this is the right term) as opposed to arrays of 2 object keys that don’t seem to correspond well to the original file].

So far, so good.

A few of the CSV files, however, are too big to load in directly to Observable. So it seems I’ll need to upload them to GitHub and then reference the URL. Doing this, however, only seems to work with `d3.csv`, which returns the non-ideally formatted arrays.

How can I run `ParseRows` on a `csv` file loaded from a URL?

Here’s a test notebook:

> **[Separating out tables from CSV](https://observablehq.com/d/a2e4715d1a055ae0)**
>
> An Observable notebook by Aaron Kyle Dennis.

Thanks in advance for your help and guidance!!

* * *

reference: [https://github.com/d3/d3-dsv](https://github.com/d3/d3-dsv)

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [September 11, 2019, 4:26pm UTC](https://talk.observablehq.com/t/d3-csvparserow-for-data-via-url/2368/2 "2019-09-11T16:26:13Z")

</div>

Try this:

```auto
d3.text(url).then(text => d3.csvParseRows(text))

```

---

<div class="post-metadata">

**Author:** ![aaronkyle](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/aaronkyle/32/8106_2.png) [@aaronkyle](https://talk.observablehq.com/u/aaronkyle)\
**Post date:** [September 11, 2019, 4:45pm UTC](https://talk.observablehq.com/t/d3-csvparserow-for-data-via-url/2368/3 "2019-09-11T16:45:03Z")

</div>

Ah, I see it now: convert the URL to text (string), then parse the text. Thank you so much!

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [September 11, 2019, 5:17pm UTC](https://talk.observablehq.com/t/d3-csvparserow-for-data-via-url/2368/4 "2019-09-11T17:17:52Z")

</div>

Yep, that’s right. And another way to write it would be:

```auto
fetch(url)
  .then(response => response.text())
  .then(text => d3.csvParseRows(text))

```

Or using `await`:

```auto
{
  const response = await fetch(url);
  const text = await response.json();
  return d3.csvParseRows(text);
}

```
