当前位置:网站首页>UNITY--读取Excel
UNITY--读取Excel
2022-07-27 18:59:00 【格拉格拉】
1.unity 读取excel文件。需导入3个dll文件到Plugins文件夹下。
分别是:Excel.dll EPPlus.dll 和 ICSharpCode.SharpZipLib.dl
链接: https://pan.baidu.com/s/1aLzl7RLZgc8Erp-ihzdYgA?pwd=2jik 提取码: 2jik2.代码部分
using System.Data;
using System.IO;
using Excel;
public class ExcelManager : Monobehaviour
{
void Start()
{
ReadExcel("/ExcelTest.xlsx"));
}
public void ReadExcel(string xmlName)
{
FileStream stream = File.Open(Application.dataPath + xmlName, FileMode.Open, FileAccess.Read, FileShare.Read);
//IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);//读取 Excel 1997-2003版本
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);//读取 2007及以后的版本
DataSet result = excelReader.AsDataSet();
if (stream != null)
{
stream.Close();
}
//return result.Tables[0];
int rows = result.Tables[0].Rows.Count;
int columns = result.Tables[0].Columns.Count;
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
Debug.LogError(result.Tables[0].Rows[i][j].ToString());
}
}
}
}边栏推荐
- R language uses LROC function of epidisplay package to visualize ROC curve of logistic regression model and output diagnostic table, visualize multiple ROC curves, and use legend function to add legen
- Paper appreciation [emnlp18] dynamic oracles for top-down and middle order move in reduction component parsing
- Force buckle 919. Complete binary tree inserter
- puzzle(021)消除问题
- The new CTO strongly prohibits the use of calendar?
- Unity 安装个人免费版
- Worthington磷脂酶A2研究丨磷脂酰胆碱2-乙酰水解酶
- ADB ~ hide or disable the status bar and virtual keys
- 中国能否在元宇宙的未来发展中取得突破,占领高地?
- 使用百度飞桨EasyDL实现电商UGC图片自动分类
猜你喜欢

mysql 最大建议行数2000w,靠谱吗?

"Geography language" large model Wenxin Ernie geol and its application

Some operations about Anaconda (installing software and quickly opening)

Comprehensively design an oppe home page -- the style of the search and oper part of the page

数字化工厂管理系统有哪些价值

MySQL back to table, SQL optimization, four isolation levels, three logs binlog, redo log, undo log

MobileVIT学习笔记

Lidar China's front loading curtain opens, millions of production capacity to be digested

Rust variable characteristics

Can China make a breakthrough in the future development of the meta universe and occupy the highland?
随机推荐
对L1正则化和L2正则化的理解[通俗易懂]
ACM mm 2022 | Zhejiang University proposed: point cloud segmentation, active learning of new SOTA
ADB ~ hide or disable the status bar and virtual keys
枚举Enum的简单使用
Principle analysis and best practice of guava cache
Rust变量特点
Custom recycleview delete & move animation
What are the product performances of industrial Ethernet switches?
IOU target tracking II: viou tracker
美国将禁止所有中国企业采购美国芯片?特朗普这样回应
Understanding Network Model OSI model
Characteristics of exonuclease in Worthington venom and related literature
Automatic classification of e-commerce UGC pictures using Baidu PaddlePaddle easydl
图解 SQL,这也太形象了吧!
When accessing the shared folder, you will be prompted "because file sharing is not secure smb1 Protocol". Please use Smb2 protocol
How to check whether there is Tsinghua source / delete Tsinghua source and keep the default source
R language uses LM function to build multiple linear regression model, writes regression equation according to model coefficient, and uses deviance function to calculate the sum of squares of residual
Summary of common methods and attributes of arrays and strings in JS
Simple use of express web server
中英文说明书丨 AbFluor 488 细胞凋亡检测试剂盒