• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by centaurianmudpig · Apr 06, 2016 at 03:57 PM · errorbuildreadexcel

Reading an excel file using ExcelReaderFacotry

Hi guys,

I'm probably just shouting in the wind here given I am using a 3rd party library (See: https://github.com/ExcelDataReader/ExcelDataReader). I started using this library as the mono implementation of reading excel file is broken for the 64bit version.

I have the ExcelDataReader functionality working in the Unity editor. I read an Excel file and store the data in memory. No problem.

I then build my game. I put the excel file into the _Data location. I run the game and now the Excel file is not being read.

Debugging using LogError shows the FileStream has been opened. There is no problem in opening the Excel file. It is in the correct location.

The problem is when I use the stream to CreateOpenXmlReader(). The excelReader.IsClosed is equal to True.

I don't understand why this is the case. The DLL's for the library are in the Managed Folder the Excel files are in the correct location.

Basically I'm asking anyone who has used ExcelDataReader and created a project build, is it solvable and how so? Thanks.

     protected void OpenDataReader(string _filename) {
         DataSet result;
 
         _filename = string.Concat(Application.dataPath, "/Data/", _filename, ".xlsx");
         FileStream stream = File.Open(_filename, FileMode.Open, FileAccess.Read);
         **excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);**  //IsClosed = True
 
         result = excelReader.AsDataSet();
         skipFirstRow = true;
     }
 
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image IvanRibakov · Jun 19, 2018 at 01:28 PM 0
Share

Were you able to get anywhere with this problem?

avatar image centaurianmudpig · Jun 19, 2018 at 04:59 PM 0
Share

I had to abandon that implementation and use a 3rd party CSV Reader. http://wiki.unity3d.com/index.php/CSVReader

avatar image IvanRibakov · Jun 19, 2018 at 06:34 PM 0
Share

I see. I was able to resolve the issue by upgrading the ExcelDataReader to the latest version (from 2.1.2.3 to 3.4.0). Unfortunately couldn't trace the problem to a specific issue/commit within the project.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MyUnitydream · Sep 12, 2018 at 05:12 AM

you can use Uni-Excel Package for Read, Write, and edit excel files

https://assetstore.unity.com/packages/tools/uni-excel-47540

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

52 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Has anyone made Android build on Unity5? 5 Answers

Why don't shadows appear in my built .exe? Unity 5 4 Answers

Failed to load mono 0 Answers

How to solve the WebGL UnityEditor.WebGL.ProgressHelper.Show Error 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges