Unity实现Excel导表操作

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


#if UNITY_EDITOR
using Newtonsoft.Json;
using OfficeOpenXml;
using UnityEditor;
using System.IO;
#endif

public class UnityTools : MonoBehaviour
{
    static int startCount = 2;    //开始行数
    static int EndCount = 500;    //结束行数


    static int nameCount = 1;      //列数下标
    static int passwordCount = 2;   //列数下标
    static int idCount = 3;     //列数下标

    [MenuItem("Disassembly/数据转换")]
    public static void ChangeData()
    {
        string excelfilepath = Path.Combine(Application.dataPath.Replace("Assets", ""), "Excel/Data.xlsx");   //这个是拿到整个excel的项目路径
        if (!File.Exists(excelfilepath))                                           //插件只支持xlsx
        {
            Debug.Log("此文件不存在");
            return;
        }

        using (ExcelPackage ep = new ExcelPackage(new FileInfo(excelfilepath)))
        {
            ExcelW

猜你喜欢

转载自blog.csdn.net/qq_37335907/article/details/125865385