How to change "File" column heading in dataview table when querying from files

Hi, when I use dataview with table, pulling data from a folder, it creates a first column File, that precedes the columns I declared, and I don’t know how to rename the first column or remove it. For example,

```dataview
table name as Name, email as "Email", phone as Phone
from "contacts"
sort name
```

The output table has four columns : “File, Name, Email, Phone” . I would like to either:

  • omit the “File” and just use the three that I declared (preferred)
  • rename the “File” column to something else (“Name”), rename the files to be the person’s name, and delete the Name column from the query.

within the “contacts” folder, each file has a yaml header

---
name: Jon
email: "[email protected]"
phone: "000-111-2222"
---

Things I have tried

I’ve tried adding “file.name as X”, which adds an X column, but doesn’t rename the one called ‘File’.

I’ve tried searching this forum and googling but I haven’t found the answer.

Even the example on the front page of the dataview git repo shows a first column “Name” - I don’t know how to reproduce that. (Also, the example query uses lower case column headings and the Preview view has upper case column headings. That’s another difference from what my version of the software does)

This is a new installation, with Osidian v0.11.13 and dataview v0.2.17

Thanks in advance!

3 Likes
1 Like

This would be a nice feature, as the filename consumes a big chunk of the row space, and in some use cases this information is not relevant and so we could have more space for data visualization. I guess this could be done with an option that completely ignores/hide the first column Or provide a way to override the first column with a user-defined column.

I got a workaround with CSS to “remove” the File column. I guess it can be useful to hide long file names, so we can have more space for the other columns.

/* hide dataview first column */
table.dataview.table-view-table td:nth-child(1), th:nth-child(1){
    display: none;
}
4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.