# Trouble loading in data from CSV file using TableToStructuredGrid filter

**URL:** https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533
**Category:** ParaView Support
**Created:** [June 7, 2020, 5:09pm UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533 "2020-06-07T17:09:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![wildecats](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@wildecats](https://discourse.paraview.org/u/wildecats)
#### Post date: [June 7, 2020, 5:09pm UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533/1 "2020-06-07T17:09:02Z")

</div>

[Error\_log\_20200607.txt](https://discourse.paraview.org/uploads/short-url/18PyqgQB1QPNSNQgsEQ5YwNwxMc.txt) (31.1 KB)

I am attempting to load in data from a CSV file into Paraview and view it using a TableToStructuredGrid filter but am having some problems. The data in my CSV file has the following header row (separated by commas): X, Y, Z, Distance, B\_X, B\_Y, B\_Z, B\_Magnitude. It contains cartesian points (X,Y,Z) and the components of the magnetic field vector at each point (B\_X, B\_Y, B\_Z), along with the total magnetic field magnitude (B\_Magnitude). The CSV file contains 2,413,800 rows of data represents 149 units in the radial direction, 90 units in the Theta direction, and 180 units in the Phi direction (149_90_180 = 2,413,800).

I am able to successfully open the CSV file in ParaView and see the data in Spreadsheet view. When I initially open the CSV file, I choose the option for “CSV Reader”. There is also an option for “GDAL Vector Reader” but if I choose that option, then I get an error message immediately upon opening the file. After selecting “CSV Reader” and clicking “Apply” in the Properties panel, I then add in a “TableToStructuredGrid” filter. In the Properties panel for this filter, I select 0 and 1 as the lower/upper bounds for each of the 3 Extents in the Whole Extent section, and I then select the X Column, Y Column ,and Z Column, as X, Y, and Z, respectively. When I then click on Apply for the filter, I get an Error message, which I have included as an attachment here. One of the main error messages that keeps recurring states that the input table must have exactly 8 rows, whereas my table has 2,413,800 rows. I am not sure why the input table is only allowed to have 8 rows.

Note also that my original dataset is stored in a .FITS file and I converted and saved it into a CSV format because that is the method I am familiar with for leading files into ParaView. Ultimately, I would like for ParaView to be able to recognize B\_X, B\_Y, and B\_Z and the components of the magnetic field vector and be able to show streamlines in Render View.

Can someone please help me understand what I am doing wrong here. I have read through the ParaView Tutorial and Guide, but don’t see much information to assist with loading in data. If there are any helpful resources I should look at, please let me know. Thanks very much

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 8, 2020, 1:55am UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533/2 "2020-06-08T01:55:33Z")

</div>

Are you able to use TableToPoints instead ?

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [June 8, 2020, 2:48am UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533/3 "2020-06-08T02:48:13Z")

</div>

The `Extents` do not mean what you think they mean. The `Extents` are the valid index range in the i, j, k indices of the 3D array. So, when you put in [0, 1] for each of these, you are telling ParaView that in each dimension you have 2 values (indices 0 and 1). Hence, the `TableToStructuredGrid` filter expects 2 \times 2 \times 2 = 8 rows.

Instead, for each index put 0 and the number of items minus 1. So, in your case the `Extents` should be 0, 148, 0, 89, 0, 179.

---

<div class="post-metadata">

### Author: ![wildecats](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@wildecats](https://discourse.paraview.org/u/wildecats)
#### Post date: [June 10, 2020, 4:58am UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533/4 "2020-06-10T04:58:26Z")

</div>

Thanks for the information on this! I updated the Extent information as you suggested and am able to see the image as I was expecting without any error message showing up. Appreciate your help.

---

<div class="post-metadata">

### Author: ![msw](https://discourse.paraview.org/user_avatar/discourse.paraview.org/msw/32/5154_2.png) [@msw](https://discourse.paraview.org/u/msw)
#### Post date: [May 6, 2021, 2:21am UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533/5 "2021-05-06T02:21:32Z")

</div>

Hey I have the same problem which you solved can you help me? I would really appreciate it.

I have a CSV file I used Filter Table to Points now trying to use Table to Structure (so that I can render Mass as a Volume) I received an error.

The input table must have exactly one rows currently it has 68920 rows.

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [May 6, 2021, 4:58am UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533/6 "2021-05-06T04:58:29Z")

</div>

Did you set the `Extents` in the `Table to Structured Grid` filter?

---

<div class="post-metadata">

### Author: ![msw](https://discourse.paraview.org/user_avatar/discourse.paraview.org/msw/32/5154_2.png) [@msw](https://discourse.paraview.org/u/msw)
#### Post date: [May 6, 2021, 5:57am UTC](https://discourse.paraview.org/t/trouble-loading-in-data-from-csv-file-using-tabletostructuredgrid-filter/4533/7 "2021-05-06T05:57:48Z")

</div>

You mean the Whole Extent no I didn’t its all 0.

Whatever values I am writing its the same error
