Load Data from Excel 2003

= Reading Excel Files and Sheets into Unity =

Sometimes you want the ability to load information from a spreadsheet into Unity, some rules you need to understand first. You need to ensure that your sheet is laid out like a table, such that the first row is the column headers, you want to avoid special characters and also keep the headers simple with no spaces. The next row will help determine the data type for the data being read into Unity. So the data in the cells need to match the data type you are reading for that entire column. If the column is to hold integers, make sure the first entry is an integer, not a letter.

There are 2 files you need to locate in Unity to copy into your assets folders.
 * First, in your windows explorer, browse to the following folder:
 * C:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0

Locate and copy the following 2 files to your project Assets folder:
 * 1) System.Data.dll
 * 2) System.EnterpriseServices.dll

Once these two files are in your assets folder, you are ready to begin. Create a CSharp asset, rename it to EXCELREADER and make sure the file name is also EXCELREADER.cs, then take the following code block and paste it in so we can you to read in a simple excel spreadsheet. The Excel workbook in this example is simply called Book1.xls and is located in the Assets folder of your project. The excel spreadsheet has the following layout:

Now, when you run the code, your debug log will show the output for each row having the values in their perspective columns.