A table needs the class downloadable. The button is appended to the table’s <caption>; a caption is added if the table has none. The CSV includes every row, header cells and data cells alike, with line breaks removed from cell text and double quotes escaped.
<table class="downloadable" data-download_filename="ladder"><caption>Thursday ladder</caption>...</table>
The file is named from data-download_filename (or export when it is missing), an underscore and the visitor’s local date.
The script is registered on every request and enqueued only when post content rendered for the page body contains a table with the downloadable class: after wp_body_open in classic and PHP templates, or while a block template renders its markup (after template_include, before wp_head). Content run for the page head, such as excerpts built for meta tags, content run by other plugins before the template renders, and feeds are never inspected. In wp-admin the script is loaded on every screen and adds the button to list tables.
lh_downloadable_tables_script_handle_filter: the handle of the script enqueued when a downloadable table is found (default lh_downloadable_tables-script). Return a different registered handle to use your own script, or an empty value to load nothing.