- Home /
Read XLS file with UTF-8 character;
I am using this script that is working. But in unity i can't get the strings from the shells. The are greek characters like "Κάλη μέρα" but i get "???? ????".
How i can get thisd work?
i try this but din;t change anything.
string con = "Driver={Microsoft Excel Driver (*.xls)};characterEncoding=UTF-8;CharSet=UTF-8;DriverId=790; Dbq="+filetoread+";";
the script i get it from : http://wiki.unity3d.com/index.php?title=Load_Data_from_Excel_2003
 void readXLS( string filetoread)
     {
         // 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(); 
         // lets use a datareader to fill that table! 
         OdbcDataReader rData = oCmd.ExecuteReader(); 
         // now lets blast that into the table by sheer man power! 
         dtYourData.Load(rData); 
         // close that reader! 
         rData.Close(); 
         // close your connection to the spreadsheet! 
         oCon.Close(); 
         // wow look at us go now! we are on a roll!!!!! 
         // lets now see if our table has the spreadsheet data in it, shall we? 
  
         if(dtYourData.Rows.Count > 0) 
         { 
             // do something with the data here 
             // but how do I do this you ask??? good question! 
             for (int i = 0; i < dtYourData.Rows.Count; i++) 
             { 
                 // for giggles, lets see the column name then the data for that column! 
                 Debug.Log(dtYourData.Columns[0].ColumnName + " : " + dtYourData.Rows[i][dtYourData.Columns[0].ColumnName].ToString() + 
                     "  |  " + dtYourData.Columns[1].ColumnName + " : " + dtYourData.Rows[i][dtYourData.Columns[1].ColumnName].ToString() + 
                     "  |  " + dtYourData.Columns[2].ColumnName + " : " + dtYourData.Rows[i][dtYourData.Columns[2].ColumnName].ToString()); 
             } 
         } 
     }
Answer by MyUnitydream · Jan 08, 2016 at 08:11 PM
hi.
uni-excel can create, read and edit excel files in unity3d https://www.assetstore.unity3d.com/en/#!/content/47540
support: arabic and persian language
by thanks
Your answer
 
 
             Follow this Question
Related Questions
Local database on iOS 1 Answer
Good way to read/write .xlsx files 2 Answers
UTF-8 for foreign language characters on GUI 2 Answers
How to import data into Microsoft Excel? 1 Answer
Best tool to load data 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                