Coder Social home page Coder Social logo

excel4unity's Introduction

Excel4Unity

Excel for Unity

Provides

  • Excel(.xlsx) Read/Write
  • Format Excel sheet into custom object (Excel,ExcelTable...)
  • Edit .xlsx file in Unity EditorWindow
  • Generate .cs model according to .xls
  • Conver .xlsx file to JSON format

How to use

read & write

string excelPath = Application.dataPath + "/Test/Test.xlsx";
string outputPath = Application.dataPath + "/Test/Test2.xlsx";
Excel xls = ExcelHelper.LoadExcel(excelPath);
xls.ShowLog();

xls.Tables[0].SetValue(1, 1, "???");
ExcelHelper.SaveExcel(xls, outputPath);

generate .cs file

string path = Application.dataPath + "/Test/Test4.xlsx";
Excel xls =  ExcelHelper.LoadExcel(path);
ExcelDeserializer ed = new ExcelDeserializer();
ed.FieldNameLine = 1;
ed.FieldTypeLine = 2;
ed.FieldValueLine = 3;
ed.IgnoreSymbol = "#";
ed.ModelPath = Application.dataPath + "/Editor/Excel4Unity/DataItem.txt";
ed.GenerateCS(xls.Tables[0]);

convert to json

Object[] objs = Selection.objects;
for (int i = 0; i < objs.Length; i++)
{
    string path = AssetDatabase.GetAssetPath(objs[i]);
    if (path.EndsWith(".xlsx"))
    {
        Excel4Unity.ParseFile(path);
    }
    else
    {
        EditorUtility.DisplayDialog("提示", "暂不支持的文件格式" + path, "ok");
        return;
    }
}
AssetDatabase.Refresh();

Dependency

  • EEPlus
  • .Net 2.0 instead of .Net 2.0 Subset if you want to do excel job runtime

Version

Unity 4.x or higher

excel4unity's People

Contributors

coeur avatar guangpingmo avatar joexi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.