Tabulator- Built In Download to CSV/Excel Button

Is it possible to have a built in button to download the data in Tabulator to excel/csv (like how Plotly Charts have built in zoom/lasso/etc). Feels that every time I add a tabulator I need to build this feature and I bet would be globally appreciated. thank you kind developers of Anvil. Tabulator for Anvil is incredible btw - just thinking of cool adds for the future.

1 Like

this one might be better to post in GitHub - anvilistas/tabulator: Anvil Wrapper for Tabulator

might also be worth sharing a minimal example of what you typically do
this could then form the basis of the feature :slightly_smiling_face:

Thanks Stu will put it on the github. Sneak preview is what i do now is on the first column (just to fake it as if it is for the whole Tab) for any given tabulator, adding a headerMenu and making it look like a Download emoji:


tab.columns = [
      {"title": "Date",   "headerMenu": self.header_menu, "headerMenuIcon": "⬇️",   ........

that self.header_menu is simply:

    self.header_menu = [
      {
        "label": """
            <div style='display:flex; align-items:center; gap:12px; padding: 4px 0;'>
                <i class="fa fa-file-excel-o" style="color:#22c55e; font-size:17px;"></i>
                <div style='line-height: 1.2;'>
                    <div style='font-weight:bold; color:#fff; font-size:14px;'>Download Excel</div>
                </div>
            </div>
        """,
        "action": self._handle_menu_download 
      }
    ]  

and that action self…_handle_menu_download is:


  def _handle_menu_download(self, e, column):
    """Simplified downloader that adds a timestamp to the filename."""
    # 1. Identify which table triggered the download
    table = column.get_table()
  
    # 2. Generate current date and time string (e.g., 2026-02-09_1430)
    timestamp = datetime.now().strftime("%Y-%m-%d_%H%M")
  
    # 3. Construct final filename
    final_filename = f"Dashboard_export_{timestamp}.xlsx"
  
    # 4. Execute the built-in Tabulator download
    try:
      table.download("xlsx", final_filename)
      Notification(f"Downloading {final_filename}", style="success", timeout=2).show()
    except Exception as ex:
      alert(f"Download failed: {ex}")

this works great except is obviously a bit tedious to make every time, and I am still struggling to get the download button to be flush to the left without affecting the column’s title alignment being more centered.

I will post to the github as soon as I can. Thanks for all you do for us. - CyCy