import field names with spreadsheet data into sheet

I followed the directions about importing a tab separated spreadsheet file ending in .tab into a DTPro as a sheet. This worked, but the resulting sheet gets generic AA AB etc field names.

The spreadsheet was arranged so that the first line (i.e. record) was the field names.

How can I get DT Pro to name the fields of the sheet using those field names from the first record of the .tab file?

Thanks!

Hi,

some post earlier I recommended just trying. Now I wanted to make fun of the male half of humankind, that prefers assuming things and talking instead of just doing. :laughing: But I was wrong :blush:

Christian has changed some features of the exported table, and as I see, he has heard some of my complaints of the old format, thanks!

Here are the steps with the new changes:

  • Export as text,
  • change “.txt” to “.tsv”
  • drag and drop onto your DT window.
  • The table should be there.
    (Only problem: Comments in the comments field, I should try that out, but unfortunately I am busy with something else these exciting DTPro beta-days :imp:)

Have a look into the exported text file in order to get the file format.

Best,
Maria

Maria:

You got us!

The .tsv suffix is better than the .tab suffix.

The .tsv does indeed work, but it doesn’t get the sheet fields named according to the fieldnames in the first line of my data file. Anyone got a way to do that? Perhaps a script will be needed.

YYYYYepp… 8)

This is the way, I checked it again.

One problem accurs, if you have a column with the same name as the ID column DT creates by default, it is named “Name” (in German) by default. So there must not be a column named “Name” beside that. The same for the English version I suppose.

Maria

[/quote]

I was unclear sorry, no script is needed, just text export and another suffix. Reimport creates an identical table/sheet, data sets are duplicates of the original.

Maria

I have field names with the word “Name” in them, but no field is just the word “Name”, nor do any of the fields begin with the word “Name”.

I shall try a simpler test file.

Update: I tried a two line file with three tab separated columns and two rows. I want the first row’s columns to be the name of the sheet’s fields. Gave it .tsv extension and dragged the file to DT Pro. I still end up with A, B, C as the generic field (column) names.

OK, could you try this to look for the point when the error occurs:

Export the test sheet as text and open the “…txt” file in TextEdit – the names of the columns should be your names. If they are AA, AB etc., something is wrong with the export. – Then could you rename the column titles as you like,

With the correct text file, change the suffix to “tsv” and reimport to DT. The result should be a database with the names you wish. If not, if again, AA, AB etc. turn up there is something wrong with import – or both.

Anyway, a good idea might be repairing the database, backing up and optimizing, and of course, you could try the same procedure with a fresh and clean new dummy database.

Best,
Maria

OK, I followed Maria’s debugging suggestions, and the trick appears to be to insert in the spreadsheet a dummy first column with the first line (first field) being “Name”. Then there have to be dummy first column data for the rest of the spread sheet lines. Those dummy names will end up being the names of the records in the sheet.

In my case I copied the first column of the spreadsheet and then inserted it before the original first column of the spreadsheet. Then I changed the name of the first cell in the new first column to “Name” (without the quotes). Then I saved the spreadsheet as a .csv format, using TAB as the column delimiter. Then I used the finder to change the .csv ending to .tsv. Then I dragged the file onto the DT Pro window. That works for me.

Addendum:

There are inconsistencies about which I wrote to Christian. Most important to know: If you open the spreadsheet look with the button or menu command “open externally”, it opens as a “.tsv”-file in a TextEditor, with the old .tsv-format.

This old format has some redundancies, but it saves the comment fields as well, therefore sometimes better than text export.

Of course, the final version off DTP should have the best of both worlds in only one version.

Maria