Exporting data in Unity to open in Excel as a spreadsheet - writing using CSV format, Super Easy!

preview_player
Показать описание
Exporting data in Unity to open in Excel as a spreadsheet - writing using CSV format, Super Easy!

Any comments or questions welcome. Enjoy the video!

Song: TheFatRat - Ascendancy, allowed to be used as per
Рекомендации по теме
Комментарии
Автор

Thanks for the video! Love it! Thumps up! To anyone having problems with this code, because UNITY is written everything in the same column, the problem is because the format of the ", " So you have 2 solutions:

1.- Open Excel, go to the DATA tab, go to FROM TEXT/CSV and click on LOAD. This will bring you the solution of the format.

or

2.- Inside the code, repalce the ", " for ";" and use the Encoding.UTF8 like this:

// Create a StreamWriter with UTF-8 encoding
using (StreamWriter sw = new StreamWriter(filename, false, Encoding.UTF8))
{
// Write the header


Debug.Log("Writing CSV file...");

// Write each player's data
for (int i = 0; i < myPlayerList.player.Length; i++)
{
string playerName = myPlayerList.player[i].NAME.Replace(";", ""); // Remove any semicolons in the name

sw.WriteLine(string.Format("{0};{1};{2};{3};{4}",
myPlayerList.player[i].THING1,
myPlayerList.player[i].THING2,
myPlayerList.player[i].THING3,
playerName);
}

RogelioIturra
Автор

The video is quite helpful, thanks a ton!

yashaswiification
Автор

First things first, awesome content. Simple, Precise, Practical, and to the point.
Now that made me look at your other content and I have to say your content is awesome. Keep them coming.
Just one piece of advice, do something about the audio or add precise subtitles.
Subbed!👍👍

And yeah, can you also share the script.

ishan
Автор

This was so helpful! Thanks for the tutorial!

augustrothpletz
Автор

Very helpful video I want to get the script for my project I should to save data in excel

elbouhalisiham
Автор

This is an excellent tutorial! I successfully exported the csv file for my data. I have a further question: how i can add a new line of data in a **seperate scene (like level2 of a game)** directly to the same csv file so that I can export all the data information at once. I would really appreciate it if you could give some hints for this case. Thanks a lot!!🥳

xueningpeng
Автор

Awesome video! Would it also read and write position from an AR proyect!? I was following your video but idk how to call it to write it to the CSV file, is it on void update, then Get position!?

redlocc
Автор

Hi there, great tutorial. I'm pretty new to this so quick question. If I do this same process on a mobile device, will it work? Also, does this method save the data locally to the device you are using?

robertoedlin
Автор

Great tutorial, thank you!
When having decimal numbers in the csv file, there is a 'Format Expeption Error' in Unity. Is there a way to overcome this?
Thank you

mariap
Автор

Great tutorial! Can you format this text? Change text color, cell fill, etc.?

squaredium
Автор

Hi, very helpful video! How would you recommend adding new data to the file every time an event occurs? For example, instead of having multiple players with their own data and that data is updated every save, I have one player (a car) with some data fields. Every time this car crashes against a collider each run time, I want to create a new row with the car's data field's values instead of updating the same row's values each time.

alainamagee
Автор

Hi, so I have a question about this. Is it possible to export it to an existing excel file and maybe it will create a new sheet for it ?

nikoyaz
Автор

Awesome video!But I got troubling in writing to csv. Now, I can create csv file on my android cellphone filepath. Your function is input data on unity. However, my function have to record current time(every second), but I don't know how to put my current time(string) in my csv file. It drives me crazy! I have tested it for one month.

chiyouyu
Автор

thank you for the tutorial!
1 question that is it possible to make users write the data themselves through sth like inputfield ?

zcdcx
Автор

Hi! Thank you so much for this helpful tutorial but Mine don't work. It doesn't recognise something. The error message below
Assets\CSVWriter.cs(45, 9): error CS0103: The name 'tw' does not exist in the current context

faicalcompaore
Автор

Very helpful conceptually. For VR applications, I'm curious if you could extract position data (x, y, z) during a game of the movement of the controllers in space. Any resources you could point me to? Beginner here

munibali
Автор

Many thanks for this tutorial, I have a question about exporting data in terms of VR tour. I want to record the changing of the position data, instead of continuously record their data every frame. The details of the data should only contain position data and the order of the changinG, for example, Do you have a cue?

canlongliu
Автор

Thank you so much sir, can i export image too?

MelihcanOzdemir
Автор

Your method works wonderfully but I'm having an issue where if I read the file during runtime, add a new data object, then write the file again, the excel spreadsheet shows extra empty rows between the real entries instead of each entry being stacked one after the other. However, every time I read the file again, it displays in the inspector just fine. Any ideas on what might be causing this?

obvdrc
Автор

Is it possible to make this entire csv read/write be done via the webtool so that I could store the data in a google sheet or csv file on a cloudshare?

mllhild