How to use

Once the plugin is imported to your project you may start using it. No further setup actions are needed.

Adding Spreadsheet as a data source

You can use any number of documents as a data source for your project. Here are a few simple steps that allow you to add a document.

1) Open the plugin settings from the Unity editor menu. Stan's Assets -> Productivity -> Google Sheets

2) Create a Google Spreadsheet document association by clicking “Add new Spreadsheet”. Enter the document name. This name will be used as a document id in your project. it doesn't have to do much with the real document name.

3)  Fill Spreadsheet public key field key.

4) Make sure that the Spreadsheet visibility options under the document sharing settings are Public on the web or Anyone with the link.

Click the “Update ” button to retrieve document data to the cash file. Every time you want to grab new data from the document you can update the cache using Update button.

Note: Every document has a timestamp with the time when it was changed. The timestamp is displayed next to  the document name.


Warning:  All the document lines should have some data or Google Request API will simply ignore these rows. Unfortunately, this is how the API works. You can just look at the example document to understand what that means.


You can also use Spreadsheet pages as different data sources. Instead of using different spreadsheets. To register a page in an associated document just follow these simple steps below:

  • Open the page in the google spreadsheet that you want to add
  • Copy worksheet  grid   
  • Click Add new Worksheet in the document settings.
  • Paste the grid to the Worksheet ID field, and enter the Worksheet Name. This name will be used as the worksheet id in your project. it doesn't have to be related to the real document name.

Read Spreadsheet data 

The following code snippet demonstrates how you can read linked document data:

using SA.Productivity.GoogleSheets;

string val;
string DOC_NAME = "Google Doc Connector Example";
//add doc with key: 1QksomIl0laIk3yfGWICr9_56Bez0jp8_eoQSUJU6jDY

//Using cell col / row indexes
val = GD_API.GetValue<string>(DOC_NAME, 1, 1);

//Using GDCell class with col / row indexes
GD_Cell cell =  new GD_Cell(1, 1);
val = GD_API.GetValue<string>(DOC_NAME, cell);

//Using GDCell class with key representation
cell =  new GD_Cell("A1");
val = GD_API.GetValue<string>(DOC_NAME, cell);

List<int> array;
GD_CellRange range =  new GD_CellRange();
range.StartCell =  new GD_Cell("C11");
range.UseLinebreak = true;
range.LineLength = 3;

array = GD_API.GetList<int>(DOC_NAME, range);

foreach (int data in array) {
	Debug.Log("List Data: " + data);