UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Data Systems / Table Management System Completed

Data Systems — UGTK

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


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

  1. Add Mn_DatabaseToExcelExporter to a GameObject and assign the databaseAsset (any supported database ScriptableObject).
  2. Configure the export: optional customFileName and subFolderName, includeIdColumn, excludedFieldNames, sortRules, and the filter options (useFilter, filterFieldName, filterMode Equals/RangeInclusive, values or useTodayForDate).
  3. 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 to UGTK_DownloadXlsx. OnExportCompleted / OnExportFailed report the result.
  4. For server tables use Mn_DatabaseToExcelPhpExporter: set the Php File Url and call Execute(). 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:

  1. 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.
  2. 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.xlsx for 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


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 6 modules in total.