Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Excel to Json Converter

Discussion in 'Assets and Asset Store' started by SimteractiveDev, Jul 19, 2015.

  1. SimteractiveDev

    SimteractiveDev

    Joined:
    Jul 9, 2014
    Posts:
    97
    Hi all,

    For my games, I tend to put as much of the game data (such as in game item prices, unlock levels etc) as I can out into separate config files to enable tuning the game without needing to modify the code. For this I normally use Excel to create the config files, and then convert them to json so they can be easily read in via code.

    Anyway, I've made a simple Editor plugin that allows you to convert excel files to json within Unity. You can do it manually via a window or it can be performed automatically whenever Unity refreshes (such as after an script change for example). If this is useful to anybody else, you can grab it from here.

    Notes:
    • Supports .xls (1997 - 2004) and .xlsx (2007) excel file formats.
    • Supports multiple sheets per file. Each sheet is saved separately to a Json file with the same name. (e.g. Sheet1 saved to Sheet1.json)
    • Assumes that the first row of a sheet are column headers.
    • If you want to ignore a column and not have it saved in the Json file, prefix the column header with '~'. E.G. ~Notes
    • If you want to ignore a sheet and not have it converted to Json, prefix the sheet name with '~'. E.G. ~Temp
    • Automatically scans and updates excel files when editor refreshes (e.g. after a script is changed)

    Note: This has only been tested on Mac. It should work on Windows also, but you may need to delete the Mono folder within ExcelToJsonConverter directory (otherwise there may be a conflict with System.Data.dll in windows).
     
  2. KhaledM

    KhaledM

    Joined:
    Sep 29, 2013
    Posts:
    41
    Hey Thank you very much, it is really useful
     
  3. KristianHJ

    KristianHJ

    Joined:
    May 28, 2010
    Posts:
    344
    Second that. This is just what I needed
     
  4. SimteractiveDev

    SimteractiveDev

    Joined:
    Jul 9, 2014
    Posts:
    97
    No problem, glad it's useful to others :)
     
  5. atcae102410

    atcae102410

    Joined:
    Sep 14, 2016
    Posts:
    3
    Great plugin. Thanks for it.
    It works fine in the editor and when I build it for windows, it doesn't work.
    As you've mentioned that we may need to delete the Mono folder for windows, if I delete the Mono folder, it gives error that It cannot find the System.Data file.
    I can't find the issue, can you please help me out in finding what could have been gone wrong in it?
     
    Last edited: Sep 14, 2016
  6. SimteractiveDev

    SimteractiveDev

    Joined:
    Jul 9, 2014
    Posts:
    97
    Hi atcae102410,

    Sorry I should have specified that this is an editor plugin, it's designed to only be used within the editor and not in an actual build. The code example I give in github is meant to be called from an editor script, not a game script.

    I don't know what error you are getting, but I assume it can't find the plugin as it's in the editor folder which is excluded when doing a build. It may work if you move the plugin folder out of the editor folder, worth a try. Unfortunately I don't have the time to check it out at the moment, and as I mentioned before it's not designed for runtime use, so even if it does work, performance may be poor.

    You say it works fine in the editor, do you mean in windows? If it works fine in the windows editor, then it appears you do not need to delete the Mono folder after all.
     
  7. atcae102410

    atcae102410

    Joined:
    Sep 14, 2016
    Posts:
    3
    Yes it works fine in window's editor and I moved the plugin out of Editor folder to test it on windows editor and it worked fine, though never worked on build as you said its an editor plugin. Thanks for clearing it.
    Though if you know any other plugin that would work on build at run-time, please mention it, it would be a great help.
     
  8. SimteractiveDev

    SimteractiveDev

    Joined:
    Jul 9, 2014
    Posts:
    97
    I'm not aware of any plugins I'm afraid, thats why I made this one a while back, but I didn't need it at runtime.
     
  9. VinesStudio

    VinesStudio

    Joined:
    Nov 14, 2016
    Posts:
    4
    It can`t work..can you help me to solve this problem?

    Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
    Copyright (C) Microsoft Corporation. All rights reserved.

    error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/vin/Desktop/UnityProjects/Roguelike2D/Assets/Editor/ExcelToJsonConverter/Mono/System.Data.dll' and '/Applications/Unity/Hub/Editor/2019.1.0f2/Unity.app/Contents/MonoBleedingEdge/lib/mono/4.7.1-api/System.Data.dll'. Remove one of the duplicate references.
     
  10. VinesStudio

    VinesStudio

    Joined:
    Nov 14, 2016
    Posts:
    4

    remove Data.dll It`s OK