当前位置:网站首页>Read excel xlsx format file in unity
Read excel xlsx format file in unity
2022-07-28 17:04:00 【More than a curtain a dream】
Encountered the need to read forms , Because the previous operation read csv Documents are familiar with , Originally, I also wanted to turn the form into csv Format read , But it is found in the actual operation , The contents of the table have commas , Is there any regular comma in the whole text , And read csv The file grids are separated by commas , So using this method will divide the text with commas in a grid into several parts , This is not what I expected . So I checked it unity Direct reading xlsx Form method . Write it down here .
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using Excel;
using System.Data;
public class ReadExcel:MonoBehaviour {
public string ExcelPathName;
void Start() {
GameReadExcel(ExcelPathName);
}
/// <summary>
/// read-only Excel Method
/// </summary>
/// <param name="ExcelPath"></param>
/// <returns></returns>
public static void GameReadExcel(string ExcelPath)
{
FileStream stream = File.Open(Application.dataPath + ExcelPath, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
DataSet result = excelReader.AsDataSet();
int columns = result.Tables[0].Columns.Count;// Get the number of columns
int rows = result.Tables[0].Rows.Count;// Get the number of lines
// Start with the second line
for (int i = 1; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
string nvalue = result.Tables[0].Rows[i][j].ToString();
Debug.Log(nvalue);
}
}
}
} It should be noted that this needs to be quoted These are sealed dll, The download addresses of the official websites of the first two :http://exceldatareader.codeplex.com/
system.data.dll The path is unity Under the installation path Editor\Data\Mono\lib\mono\unity Under this path
边栏推荐
- Semtech推出物联网地理定位解决方案LoRa Edge,首款芯片LR1110现已上市
- Re12: read these3 semantic self segmentation for abstract summary of long legal documents in low
- Re11: read EPM legal judgment prediction via event extraction with constraints
- [deep learning]: day 6 of pytorch introduction to project practice: multi-layer perceptron (including code)
- Re10: are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr
- Re11:读论文 EPM Legal Judgment Prediction via Event Extraction with Constraints
- Alibaba cloud MSE supports go language traffic protection
- In 2020q2, shipments in the global tablet market soared by 26.1%: Huawei ranked third and Lenovo increased the most!
- 打造自组/安全/可控的LoRa网!Semtech首度回应“工信部新规”影响
- 2019年全球移动通信基站市场:爱立信、华为、诺基亚分列前三
猜你喜欢

综合设计一个OPPE主页--页面的售后服务

Applet: get element node information

ERROR: transport library not found: dt_ socket

Binary representation of negative integers and floating point numbers

【深度学习】:《PyTorch入门到项目实战》第一天:数据操作和自动求导

Re10: are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr
![[deep learning]: introduction to pytorch to project practice: simple code to realize linear neural network (with code)](/img/19/18d6e94a1e0fa4a75b66cf8cd99595.png)
[deep learning]: introduction to pytorch to project practice: simple code to realize linear neural network (with code)

微软:Edge 浏览器已内置磁盘缓存压缩技术,可节省空间占用且不降低系统性能

TCP handshake, waving, time wait connection reset and other records

MySQL5.7及SQLyogV12安装及使用破解及常用命令
随机推荐
Interesting kotlin 0x06:list minus list
华为Mate 40系列曝光:大曲率双曲面屏,5nm麒麟1020处理器!还将有天玑1000+的版本
Question making note 3 (two point search)
Interesting kotlin 0x07:composition
【JS】1394- ES2022 的 8 个实用的新功能
2019年全球移动通信基站市场:爱立信、华为、诺基亚分列前三
Is smart park the trend of future development?
epoll水平出发何边沿触发
13 differences between MySQL and Oracle
综合设计一个OPPE主页--页面的售后服务
做题笔记2(两数相加)
时间复杂度
Simple addition, deletion, modification and query of commodity information
Microsoft: edge browser has built-in disk cache compression technology, which can save space and not reduce system performance
Time complexity
Re11: read EPM legal judgment prediction via event extraction with constraints
How to set ticdc synchronization data to only synchronize the specified library?
PHP calculate coordinate distance
Quickly master kotlin set functions
负整数及浮点数的二进制表示