Well, now we have parsed the excel sheet value and stored it in the model class. Use this following to read the file and call the Deserialize() to parse the CSV file, like below. It will be used to parse the text into the object. Before that, we have to create a data model class for the excel sheet. To read the files in Unity 3D get the file path and read it using System.IO. Now we have to use this script and send the text data by following method. The above is the script which parse the text data into array of data. To simplify this process I have found a script to parse the CSV file, this script will read the text input of CSV file and creates array of data based on the row and comma separation. By this we can identify the cell values and implement the logic for creating JSON object. ![]() Then separate the values based on the comma delimitar ”, “. ![]() So get the text data from the file by reading it from the file path. Since the CSV file can be accessble via notepad editor, let consider it as a regular text file. ![]() Now we have to do create some codes to get the data from the CSV file. Make sure that the file can be accessible at runtime of the application. CSV file can be opened by any spreadsheet application and in notepad editor.Īfter the conversion keep the file in Application Streaming Assets folder (I’m doing this for Windows desktop application, in your case this may differ). Once the file is ready save the sheet as CSV (Comma Separated Value) file, it is also similar to excel sheet type and you can do further changes without any conversion of CSV – Excel – CSV.
0 Comments
Leave a Reply. |