Downloads

< Back to downloads

Excel file monitor for Runtime

Version:
1.2
Format:
Unity package
Dependencies:
BGDatabase

Description

Export/import to excel file at runtime (PC/Mac/Linux only).

Features:

  1. Import/export database data from/to Excel file at runtime (in builds)
  2. Monitor excel file and auto-import the data if file changes

Setup:

  1. Import BGDatabase package and create your own database as described here
  2. Move (not copy!) Assets\BansheeGz\BGDatabase\Editor\Libs\NPOI folder to Assets folder (or to any other folder, which is not under Editor folder) Select all dlls under Assets\NPOI, and in the inspector toggle "Any Platform" on, unselect any toggle under "Excluded Platforms" and click on "Apply" button (see the screenshot below)
  3. Import BansheeGzExcelRuntime package
  4. Add Assets\BansheeGzExcelRuntime\BGExcelImportGo.cs to your scene
  5. Export required data to Excel as described here
  6. Run your scene
  7. Click to "Excel>>" button to access settings
  8. Set "File" parameter to previously exported excel file location (you can use StreamingAssets folder and relative path).
  9. Optionally set "monitoring" to true to auto monitor the file
  10. Optionally set "importOnStart" to run import on scene load
  11. Optionally press "Save Settings" to save the settings
  12. Open excel file, change the data and save the file (Ctrl+s)
  13. BGDatabase data should be updated. All binders in the scene will be executed after that.
  14. To export call BGExcelImportGo.Export method from your script. If you set "Export Meta only if sheet exists", export will ignore all tables which does not have corresponding sheet in target xls file

Example scene:

Example scene is available in Assets\BansheeGzExcelRuntime\Example\ folder. It works with Basic 3D Example project database. This example shows, how to update Player.gold field with excel at runtime.

Example scene setup:

  1. Create an empty project
  2. Import BGDatabase package
  3. Move (not copy!) Assets\BansheeGz\BGDatabase\Editor\Libs\NPOI folder to Assets folder (or to any other folder, which is not under Editor folder). Select all dlls under Assets\NPOI, and in the inspector toggle "Any Platform" on, unselect any toggle under "Excluded Platforms" and click on "Apply" button (see the screenshot above)
  4. Download database file here
  5. Download database settings file here
  6. Put both downloaded files under Resources folder
  7. Import BansheeGzExcelRuntime package
  8. Open Assets\BansheeGzExcelRuntime\Example\BGDatabaseExcelRuntimeExample.unity scene
  9. Run the scene
  10. Click on "Excel>>" button, and set "File" parameter to full testData.xls file path. (file is located here: Assets\BansheeGzExcelRuntime\Example\testData.xls, but the parameter should be set to full path, for example: c:\MyProject\Assets\BansheeGzExcelRuntime\Example\testData.xls
  11. Click on "Save Settings" button
  12. Now open testData.xls file in Excel/OpenOffice/LibreOffice, change Player.gold value, and Save the file (Ctrl+s)
  13. Value in the database and text on the screen will be changed

Troubleshooting:

  1. Some people experienced "Encoding 1252 data could not be found" error while running export/import at runtime. The solution: copy all "internationalization" dlls (I18N, I18N.West.dll etc. ) to your project as described here
  2. Some people reported "Error: No data is available for encoding 10001. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method." exception while trying to read xls file. The solution is- to import this package to your project.

Releases

Version Release date Log
1.2 July 08, 2020 Support for loading xls file from StreamingAsset folder by relative path
1.1 February 22, 2020 Export is added
1.0 July 22, 2019 Initial release