大家好,我是小bo,最近用unity写了一个读写execl的小工具,这里记录下来,帮助大家少进坑。
首先列举一下参考博文:
https://blog.youkuaiyun.com/yupu56/article/details/50580277
https://blog.youkuaiyun.com/luoyikun/article/details/81012065
http://www.xuanyusong.com/archives/2429
所需库(可在参考博文中下载):
备注:
1.你的unity版本是多少,去对应的安装目录中取dll
2.System.Data.dll 在D:\Program Files\Unity2017.2\Editor\Data\Mono\lib\mono\2.0
3.I18N开头的dll 在 D:\Program Files\Unity2017.2\Editor\Data\Mono\lib\mono\unity
读写代码:
void ReadExcel()
{
FileStream stream = File.Open (Application.dataPath + "/Test.xlsx", FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader (stream);
do{
// sheet name
Debug.Log(excelReader.Name);