How would I go about coding a script that would allow me to take data from a gyroscope and put it into either a data table exportable to Excel or directly onto Excel each frame? Also I don’t have the money for Uni-Excel. I’ve tried using a slightly altered version of http://stackoverflow.com/questions/23041021/how-to-write-some-data-to-excel-file-xlsx but I am unable to reference the Microsoft.Office namespace even though I have Microsoft.Office.Interop.Excel added through VS 2015’s add reference option.
Any ideas?
Thanks,
IF your data don’t need format like colors, font styles, etc… use CSV instead
IEnumerator CrearArchivoCSV(string nombreArchivo)
{
string ruta = Application.persistentDataPath + "/" + nombreArchivo + ".csv";
//El archivo existe? lo BORRAMOS
if (File.Exists(ruta))
{
File.Delete(ruta);
}
//Crear el archivo
var sr = File.CreateText(ruta);
string datosCSV = "valor1,valor2,valor3,valor4" + System.Enviroment.NewLine;
datosCSV += "valor1,valor2,valor3,valor4" + System.Enviroment.NewLine;
datosCSV += "valor1,valor2,valor3,valor4" + System.Enviroment.NewLine;
datosCSV += "valor1,valor2,valor3,valor4" + System.Enviroment.NewLine;
datosCSV += "valor1,valor2,valor3,valor4";
sr.WriteLine(datosCSV);
//Dejar como sólo de lectura
FileInfo fInfo = new FileInfo(ruta);
fInfo.IsReadOnly = true;
//Cerrar
sr.Close();
yield return new WaitForSeconds(0.5f);//Esperamos para estar seguros que escriba el archivo
//Abrimos archivo recien creado
Application.OpenURL(ruta);
}
you can use Uni-Excel Package for Read, Write, and edit excel files