Get Dataview Table

🚨 Working with Dataview actions requires the Dataview community plugin.

Screenshot of the action

This action queries Dataview and returns the results of a DQL table query as a nested list of strings, i.e. a list of list(s) of strings.

Dataview is an advanced topic that opens up a lot of possibilities for making sense of your notes and data. For information about DQL (Dataview Query Language), please see the related documentation on the Dataview site.


Pro Tip

Construct your queries directly in Obsidian and once you're happy with it, copy them into the action — you will save some time this way as the DQL debugging notices and error messages are more readable in Obsidian itself.


Examples

Please note: The examples will not explain the syntax of DQL (because the official documentation already does that well).

In my Obsidian note there is this DV query to get a table of notes. These notes contact details of people. I want the fields phone and email from each note, but I only want to include the notes that include a field contact_id :

```dataview

TABLE

phone, email

FROM "Contacts"

WHERE contact_id != NULL

```

Outside of the editor mode, the result is a table:

File (3) phone email
Bella Belle +49 345 67890 bella.belle@example.com
Dotti Dottirsdottir +49 12 345678 dotdotdot@example.com
Gunnar Gunnarssonsson +49 2345678922222222 gunnar.gunnarssonsson@gmail.com

(In Obsidian's Reading mode, the first column of the results is always linked to the related note. It just isn't here.)

When the query is executed, Dataview constructs a list for each result row. By default, the first field in each row is an Obsidian link. The following fields are the additional fields listed in the query, in this case, phone and email . As a data structure, the result looks like this:

[

[ "[[Contacts/Bella Belle.md|Bella Belle]]", "+49 345 67890", "bella.belle@example.com" ],

[ "[[Contacts/Dotti Dottirsdottir.md|Dotti Dottirsdottir]]", "+49 12 345678", "dotdotdot@example.com" ],

[ "[[Contacts/Gunnar Gunnarssonsson.md|Gunnar Gunnarssonsson]]", "+49 2345678922222222", "gunnar.gunnarssonsson@gmail.com" ]

]

And that is exactly what this action will return: a list of table rows, i.e. a list of a list of strings.

Each table row in a result is returned in the form of a Dataview Table Row object. This object has a property "Columns" — which in itself is a list of strings, i.e. this row's fields.

See this screenshot / diagram on how you would access each table row's first field (note link) and second field (phone number):

If you plan to work a lot with this Dataview action, I recommend checking out the various list-related actions from Sindre Sorhus's excellent Actions app.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Carlo Contact Carlo