# CSV supplying data to input | extreme newbie: stumbling over basics

**URL:** <https://talk.observablehq.com/t/csv-supplying-data-to-input-extreme-newbie-stumbling-over-basics/1425>\
**Category:** Help\
**Created:** [November 22, 2018, 3:19am UTC](https://talk.observablehq.com/t/csv-supplying-data-to-input-extreme-newbie-stumbling-over-basics/1425 "2018-11-22T03:19:49Z")\
**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:** [November 22, 2018, 3:19am UTC](https://talk.observablehq.com/t/csv-supplying-data-to-input-extreme-newbie-stumbling-over-basics/1425/1 "2018-11-22T03:19:49Z")

</div>

Hi Community.

Thanks to everyone for being amazing. I come to Observable daily to read and learn.

I am slowly teaching myself, and still I stumble over basic concepts (extreme fundamentals). I appeal to your help because, well, people here are nice! Thank you.

I am learning how to query a data table to populate dropdown options. To start, I though it would be fun to try to read these data from a CSV, which supplies attributes for a single variable, like this:

```auto
viewof case_status_dropdown = select({
  title: "Status",
  description: "Drop down to filter.",
  options: case_status_data,
  value: "Active"
})

```

```auto
case_status_data = d3.csvParse(`
Active, Closed
`)

```

Turns out this isn’t as simple as I expected.

I would ideally like to name just a data attribute and edit a comma separated list to add or remove dropdown options.

Can someone help me to better understand how to call in data from a CSV? I would also appreciate pointers for beginners on how to read points within a CSV, such as value of a particular `status` or `attribute` of a given `case`.

Here’s where I am at, having [read and learned from Jeremy](https://beta.observablehq.com/@jashkenas/inputs):

> **[Data Capture / Observable](https://beta.observablehq.com/d/743d28a5269ca6e3)**
>
> A better way to code.

Other references:

- [Introduction to Data](https://beta.observablehq.com/@mbostock/introduction-to-data)
- [Manipulating Flat Arrays](https://beta.observablehq.com/@mbostock/manipulating-flat-arrays)

---

<div class="post-metadata">

**Author:** ![bgchen](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/bgchen/32/784_2.png) [@bgchen](https://talk.observablehq.com/u/bgchen)\
**Post date:** [November 22, 2018, 3:44am UTC](https://talk.observablehq.com/t/csv-supplying-data-to-input-extreme-newbie-stumbling-over-basics/1425/2 "2018-11-22T03:44:40Z")

</div>

It looks to me like your CSV data isn’t formatted properly. In particular, if you start your CSV string with an empty line, then the column names will be empty and it will be hard to extract the data from the list of objects that `d3.csvparse` returns. Also, spaces after the commas will be included in the data fields, so they should usually be avoided.

See [the beginning of the SO answer you linked](https://stackoverflow.com/a/24589035/9435803) in your notebook.

Here’s a fork which might help:

> **[Observable](https://beta.observablehq.com/compare/743d28a5269ca6e3@370...0925d9f45b31861e@398)**
>
> A better way to code.

Let me know if I should explain more!

---

<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:** [November 22, 2018, 10:53am UTC](https://talk.observablehq.com/t/csv-supplying-data-to-input-extreme-newbie-stumbling-over-basics/1425/3 "2018-11-22T10:53:36Z")

</div>

Thanks [Bryan](https://beta.observablehq.com/@bryangingechen)!

This does help a lot. I missed the meaning of the part of the Stack Overflow dialog that was talking about CSV field names. Your explanation and example clarified a lot. Thanks for your time and patience!

By the way - I caught your notebook ‘’ [Importing data from Google Spreadsheets into a notebook / webpage](https://beta.observablehq.com/@bryangingechen/importing-data-from-google-spreadsheets-into-a-notebook-we)" a while back – thanks for making and sharing it! As you can see, I am still struggling quite a bit as I learn the ways of data and the Internet. I haven’t started much to work with databases. I appreciate your help to present a solution that would covert a spreadsheet into an ad hoc database without needed to use something more advanced, like SQL.

Thanks again!!

---

<div class="post-metadata">

**Author:** ![bgchen](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/bgchen/32/784_2.png) [@bgchen](https://talk.observablehq.com/u/bgchen)\
**Post date:** [November 22, 2018, 2:56pm UTC](https://talk.observablehq.com/t/csv-supplying-data-to-input-extreme-newbie-stumbling-over-basics/1425/4 "2018-11-22T14:56:54Z")

</div>

Glad I could help! And yeah, I stumbled upon the Google spreadsheets stuff when I was looking into an easy data solution for an a website a friend was involved with. Observable made it fun and easy to prototype, so I figured it was only fair to share what I learned here.

Happy Thanksgiving!
