使用FlexReader插件,可以在webgl下读取Excel中的数据
using System.Collections;
using FlexFramework.Excel;
using UnityEngine;
using UnityEngine.Networking;
public class ReadXlsx : MonoBehaviour
{
void Start()
{
StartCoroutine(IELoadXlsx());
}
IEnumerator IELoadXlsx()
{
string path = Application.streamingAssetsPath + "/Data.xlsx";
yield return null;
using (UnityWebRequest webRequest = UnityWebRequest.Get(path))
{
yield return webRequest.SendWebRequest();
Debug.Log("Code:" + webRequest.responseCode);
if (webRequest.responseCode == 200)
{
WorkBook book = new WorkBook(webRequest.downloadHandler.data);
for (int i = 0; i < book[0].Rows.Count; i++)
{
for (int j = 0; j < book[0].Rows[i].Cells.Count; j+