Spreadsheet Functionality

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
Pako
Posts: 7
Joined: Mon Feb 08, 2016 2:22 pm

Spreadsheet Functionality

Post by Pako »

We can create a new spreadsheet (csv), add data to it and save it using ES2Spreadsheet.

However, I have the following questions:

1. If the target csv file already exists, would it be overwritten without a prompt, prompt before overwriting, or would the save fail?
2. Is there a way to read/load data back from a csv file, and assigned to suitable variables?

I need the "read" functionality in order to load game configuration data during development, where values would change frequently during testing. The data would be entered directly in excel, saved as csv, and then read into Unity with EasySave.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Spreadsheet Functionality

Post by Joel »

Hi there,

You can use ES2.Exists to check whether your spreadsheet file exists.

It is not currently possible to load a CSV back in, though this may be included in a future update. In the meantime you can parse a CSV yourself using the instructions below:
You could load the file as a byte array using ES2.LoadRaw, convert that byte array to a string using System.Text.Encoding.UTF8.GetString(bytes), and then separate that string into rows using string.Split(‘\n’). Then you could split each row into strings using string.Split(‘,’). It would then be up to you to convert each string value into it’s type (i.e. using int.Parse, float.Parse, etc) and create an instance of a class from it.
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Pako
Posts: 7
Joined: Mon Feb 08, 2016 2:22 pm

Re: Spreadsheet Functionality

Post by Pako »

Thank you for the very helpful and quick response!!!
Locked