UGTK / Toolkit / Data Systems / Table Management System Completed
Table Management
Summary
The Table Management module exports any UGTK ScriptableObject database (SO_GenericDatabase<T>, SO_SimpleDatabase<T>, SO_RandomicDatabase<T>) to a real .xlsx Excel file, with optional filtering, column exclusion, multi-key sorting and file-name options. It can save locally (Downloads folder), download in WebGL via a JS bridge, or upload/download the table through a PHP endpoint.
Content
Modules Dependencies
- Database System: reflects over
SO_GenericDatabase<T>/SO_SimpleDatabase<T>/SO_RandomicDatabase<T>and theirDatabaseElement<T>entries. - Api / Php Connection System:
Mn_DatabaseToExcelPhpExporterderives fromMn_PhpOperationBaseto upload/download the Excel through a PHP script.
Setup
Pick the exporter by where the file has to end up.
On the device - add the DatabaseToExcel prefab. Mn_DatabaseToExcelExporter takes any UGTK
database, applies the SortRule list you configure in the inspector, and writes an .xlsx through
TableManagementXlsxHelper. ExportCompleted carries the path, ExportFailed the reason.
On a server - add DatabaseToExcelPHP instead. Mn_DatabaseToExcelPhpExporter is a
Mn_PhpOperationBase: copy Php/export_table.php and Php/db_connect.php to your backend, point
the component at the endpoint, and sort with PhpSortRule. Php/README.md documents the expected
table shape.
In WebGL, a file cannot simply be written. The browser has no filesystem for the page, so the
module ships Plugins/WebGL/UGTK_TableDownload.jslib, which hands the bytes to the browser as a
download instead. It is included automatically; there is nothing to configure, but it does mean the
result is a download prompt for the user rather than a path your code can reopen.
How To Use
- Add
Mn_DatabaseToExcelExporterto a GameObject and assign thedatabaseAsset(any supported database ScriptableObject). - Configure the export: optional
customFileNameandsubFolderName,includeIdColumn,excludedFieldNames,sortRules, and the filter options (useFilter,filterFieldName,filterModeEquals/RangeInclusive, values oruseTodayForDate). - Call
ExportDatabaseToExcel()(also available via the context menu). The row/header data is built by reflection, written with the XLSX helper, and revealed in the OS file explorer; on WebGL the bytes are handed toUGTK_DownloadXlsx.OnExportCompleted/OnExportFailedreport the result. - For server tables use
Mn_DatabaseToExcelPhpExporter: set thePhp File Urland callExecute(). With no database linked it downloads the server's Excel; with a database linked it builds the Excel and uploads it.
Testing Scene
Open Debug/TableManagementScene.unity. Two objects, one per exporter: DatabaseToExcel with
Mn_DatabaseToExcelExporter, which writes a file on this machine, and DatabaseToExcelPHP with
Mn_DatabaseToExcelPhpExporter, which talks to a server. Everything below happens in the
Inspector, with no play mode.
On DatabaseToExcel:
- Database Asset is already set to
ExampleSimpleDatabase, borrowed from the Database System's own debug folder. The inspector reports Database Elements: 4, which is the quickest check that the asset is the one you meant. - Type a Custom File Name and a Sub Folder Name, then press Export to Excel (CSV). The
file is written and Windows opens the folder on it —
Downloads/Exports/players_export.xlsxfor the values in the GIF.
The one thing worth knowing before pointing it at your own data: not every database exports.
The exporter turns each element's fields into columns, so a database whose element is a plain
int has no columns to make and the export fails with "Failed to build export data". Elements
have to be a serialisable struct or class. ExampleListDatabase is exactly that failing case if you
want to see it.
Columns to Exclude and Sort Rows shape the output without touching the data: excluded fields never reach the XLSX, and the first sort rule is the primary key.
DatabaseToExcelPHP does the same over HTTP and needs the PHP side installed — see
Php/README.md. Without a database assigned it becomes a downloader instead: a
GET on the endpoint returns the whole table as Excel.
Technical Info
- Mn_DatabaseToExcelExporter: builds the export data by reflection, applies filter/sort, and writes the
.xlsxlocally or via the WebGL JS bridge. - Mn_DatabaseToExcelPhpExporter: same export pipeline targeted at a PHP endpoint (upload built Excel or download the server table).
- TableManagementXlsxHelper: creates the minimal XLSX byte stream (single centered worksheet, auto column widths).
- Mn_DatabaseToExcelExporterEditor / Mn_DatabaseToExcelPhpExporterEditor: custom inspectors.
© 2026 Marcello De Bonis. All rights reserved
Depends on 2
Used by 1
Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 6 modules in total.
UGTKengine within an engine

