Import blocks of CSV data stored in one text file


I have multiple blocks of CSV data stored in one text file. It is effectively a 3D table where each slice is written out separately. The blocks always start with a ‘name’, followed by a table of numbers. Best understood by an example:

3D table.txt (291 Bytes)

How can I import all the data? I prefer not to use the split files function because I don’t need lots of files! Can’t a I split into multiple tables?

Many thanks!

1 Like

Welcome to the Community, @hambo

What you have is a sectioned table. Such tables have rows that separate one section from another. Therefore, the approach is to make a column from such rows, so that indication of a section comes from a column, not a row.

Below is a sample project that does it. It works as follows:

  1. Tidy up the source data, remove tab characters after “name”.
  2. Create a column where all values are empty, except for the rows that indicate the start of a section. For such rows put the section name into that column.
  3. Fill down the column with section names – populate empty cells with the section name above.
  4. Remove rows that have no numerical data – i.e. rows with column headers and section names.

load sectioned table.morph (4.3 KB)
3D table.txt (291 Bytes)

1 Like

Ah, thanks for the nomenclature hint!

And good that you thought of using “fill gaps”, my mind was stuck thinking of iteration loops and I didn’t see that simple solution