Crave For Games

You are in the Article list. If you want a full list of the StoneDrop develompent log notes you can go to the DevLog page.
Import from Google SpreadSheets to Unity3d


Spreadsheets with configuration data examples

Configuration data import occurs only in Unity editor. For the import process I use the library GData.dll and the written class (available in the attached Unity-package) with convenient methods of authorization and import from the Spreadsheets.


Before the first import, the Google-service has to be created and access-to-SpreadSheets-data permission has to be granted.


The service creation process is the following (details are in Readme.txt of Unity-package):

1. Activate Drive API in Google Developers Console of your account;

2. Customize settings (name, icon) of a created service;

3. Create new credentials (OAuth client ID) and receive the Client ID and Client Secret.

The process of initial access permission to Google SpreadSheets data is following:

1. Save previously obtained <Client ID and Client Secret in the configuration file;

2. Start GSS Import/Setup and copy the access key in the configuration file;

3. Start GSS Import/Setup.

The credentials from these steps are used in all following data imports, no authorization is required later. Class SpreadsheetImporter has a static method GetCells that returns a two-dimensional array of the cell values in the string format for a given SpreadSheet name, tab name and range of cells.


To store the imported data the objects serialization is used (details are in the upcoming post) where the data fill the fields of the serialized object(s). A special static class with static methods (that are runnable by pressing the corresponding menu item in the editor) converts imported arrays of strings to these objects (figure 1).


Figure 1. Usage example of SpreadsheetImporter


Download link for the unity-package:[1], it was tested in Unity 5.2 and 5.3.


Link 1:

This article in social networks: