• 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
Question by JinJin · Mar 14, 2015 at 01:06 AM · unity5exception64bitexcelodbc

"Load Data from Excel with Odbc" doesn't work in Unity 5 64bit

T$$anonymous$$s works perfectly in Unity 4.6 32bit:

http://wiki.unity3d.com/index.php/Load_Data_from_Excel_2003

But Unity 5 64bit throws exception:

 // Must be saved as excel 2003 workbook, not 2007, mono issue really
 string con = "Driver={Microsoft Excel Driver (*.xls)}; DriverId=790; Dbq="+filetoread+";";
 Debug.Log(con);
 string yourQuery = "SELECT * FROM [Sheet1$]"; 
 // our odbc connector 
 OdbcConnection oCon = new OdbcConnection(con); 
 // our command object 
 OdbcCommand oCmd = new OdbcCommand(yourQuery, oCon);
 // table to hold the data 
 DataTable dtYourData = new DataTable("YourData"); 
 // open the connection 
 oCon.Open();

The last line throws exception:

OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified System.Data.Odbc.OdbcConnection.Open ()

I have downloaded and installed Microsoft Access Database Engine 2010 Redistributable

http://www.microsoft.com/en-us/download/details.aspx?id=13255

But it still does not work.

Does anyone know a solution? Thank you!

Comment
Rs

People who like this

1 Show 7
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 NapsTeam · Mar 18, 2015 at 10:35 PM 1
Share

Hi , same here it stopped working on Unity5 64 bit. Maybe dll must be recompiled?

Looking forward for a solution

Best

Domenico

avatar image ayalasan · Apr 16, 2015 at 02:15 PM 0
Share

I have the same problem, has anybody found a solution for this yet? Thanks!

avatar image spiceboy9994 · Apr 16, 2015 at 06:21 PM 0
Share

Did you configured a DSN?, if this is the case, it seems a bit to a native .net error where there's different architectures between your dsn and your client application. Have you tried creating the dsn as a 64 bit dsn?. Here's an article that explains a bit the confussion.

https://support.microsoft.com/es-es/kb/942976

Regards

avatar image JinJin · Apr 17, 2015 at 09:10 AM 0
Share

I could not solve the problem...

I replaced Driver={Microsoft Excel Driver (.xls)}; with Driver={Microsoft Excel Driver (.xls, .xlsx, .xlsm, *.xlsb)}; and it connected, but the read failed...

Now I am using this library:

https://github.com/ExcelDataReader/ExcelDataReader

and it works really good :)

avatar image JinJin · Apr 29, 2015 at 11:37 AM 2
Share

@centaurianmudpig

  • add excel.dll to you Assets folder

  • change unity project settings from using ".net 2 subset" to using ".net 2"

  • add "using Excel;" to the top of your class

  • use the code example that is on the ExcelDataReader github homepage: https://github.com/ExcelDataReader/ExcelDataReader (scroll down to "How to use")

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image

Answer by rab · Jul 23, 2015 at 10:58 AM

Check the installed ODBC Drivers on your mac$$anonymous$$ne. Install the 64 bit version or use the 32 bit Unity version to use the 32 bit ODBC driver.

More info can be found here: Unity-Forum

Kind regards.

Comment
Rs

People who like this

1 Show 0 · 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
avatar image

Answer by Reaksmey-Rt · Sep 16, 2015 at 01:22 PM

JinJin @centaurianmudpig :

I have a problem like you too and try to follow your advice but I really don't understand some point :

  • add excel.dll ( where can I find it ? )

  • Change unity project settings from using ".net 2 subset" to using".net 2"( I can't to find it in my ProjectSettings folder in my project).

So that Can you detail me more about it?

Oh... one t$$anonymous$$ng I use Unity 5.1.2 p1(64 Bit) and Excel 2010. Thank you !

Comment
Rs

People who like this

1 Show 3 · 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
avatar image JinJin · Sep 16, 2015 at 07:40 PM 0
Share

you only read my last comment. if you would read all my comments, you would see this:

Now I am using this library: https://github.com/ExcelDataReader/ExcelDataReader and it works really good :)

this is where you can download excel.dll

to access project settings, open Unity Editor and click on "Edit" and choose "Project settings" and "player"

http://www.theappguruz.com/app/uploads/2015/06/other-settings.png

look at Api compatibility level - change it to ".net 2"

avatar image Reaksmey-Rt JinJin · Sep 17, 2015 at 09:13 AM 0
Share

Oh....Thank you every much. I got it!

avatar image centaurianmudpig JinJin · Apr 06, 2016 at 07:16 PM 0
Share

JinJin did you ever try this method with a built project? I just recently tried and having a problem where ExcelReaderFactory.CreateOpenXmlReader() does not open the file, even though it works in the Editor, and I have confirmed the file paths are correct for the build.

avatar image

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

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

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

Comment

People who like this

0 Show 0 · 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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

Directory Not Found Exception While Generating APK 0 Answers

ODBCConnection.GetSchema make unity crash 0 Answers

NotImplementedException: OleDb is not implemented 0 Answers

Retrieving metadata from an excel file 1 Answer

Unity 5.0, ambiguous component reference? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges