How to access Bases data via commands

Hello everyone. I’m currently working on a Bases view and I would like to implement also a command that exports the bases data as an openoffice doc that would render as a gantt chart, something similar to the screenshot attached.

The export function works with dummy data, but I’m not sure how to 1. validate that the command is executed while my bases view is active and 2. access the data of my Bases view. I looked into the entire documentation for plugin development, but I could not find what I’m looking for, apart from how to create commands to access the editor views. I know that I can use getMostRecentLeaf to get the active tab/leaf, then I can check the view type of the leaf with view.getViewType() , but it returns the generic ‘bases’.

Any idea?

Thank you