Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Google Sheets For Unity Lite

Discussion in 'Assets and Asset Store' started by Novack, Mar 3, 2014.

  1. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Google Sheets For Unity Lite, enables the developer to send and fetch game data from Google Drive Spreadsheets at runtime, through a RESTful API.

    With more than 5 years on the store, an asset which is the result and product of actual field work, and with the accumulated experience of having thousands of users, it represents a classic and default choice for simply and efficiently connect Unity and Google Spreadsheets.

    This opens a world of posibilities for collaboratively design, development, balancing, localization, etc.

    By simplifying the process of creating, storing, handling, distributing, tweaking and importing data -among localized or distributed teams-, saving or fetching values from Google Sheets at runtime or design time, makes heavy duty tasks straightforward and pain-free.

    Check the public API reference.
    Check out the demo!


    Summary:

    Send and receive data from google spreadsheets at runtime or design time.
    • Works with all plataforms, Desktop, Mobile and WebGL builds.
    • Customize your workflow with flexible and solid Google solutions for distributed work.
    • No Google account credentials required on the Unity side.
    • Source code included.
    • Lightweight package: ~600Kb.
    • No Google API dependencies to maintain.
    • Works with privately shared Google spreadsheets.
    • Works with spreadsheets from the end-users provided they are public or shared with the developers account.
    • Simple examples included of in-game & in-editor uses.


    What is the difference with the main version?

    The original version has been rebranded "Lite" edition, to denote the difference with the new asset.

    The new version encompasses wider use cases, including and extending capabilities that used to be scattered among 3 or 4 other assets (siblings from GSFU, that I named "CloudTools"). Makes available features for Google Drive files and folder management, images, a mimic for stateful sessions, among other thingies.

    In essence, the Lite version focuses exclusively on Google Spreadsheets, while the main version goes a bit beyond.


    Changelog:

    1.2.0
    • Now the options for communicating with the Google Spreadsheets are:
    1. At runtime from the game itself.
    2. At design time, from the editor menu.
    3. At runtime, from the editor menu.
    All three options affect the scene, but the editor menu affects hierarchy assets (materials in the example case), so the changes can be persisted by simply saving the project.​

    1.5.0
    • GSFU is a Unity5-ready extension!​

    2.0.0
    • Completely refactored.
    • Moved to the new UnityWebRequest api, leaving behind the WWW class.
    • Replaced LitJson with the new Unity JsonUtility api.
    • Implemented a small, simple and clean API: simple CRUD operations between Unity and Google Spreadsheets is now posible out of the box.
    • Complete Developer Guide rewrite.​

    2.2.1

    • Refactor to include in-editor example.
    • Password protected access.
    • POST / GET Request option.
    • Extended developer guide to accomodate new features.
    • Server script updated for highly increased performance (released prior to official update).​

    2.2.2
    • Conditional compilation for editor related scripts.​
    Update (19th January 2019):
    • From this date, this version will be branded as the Lite version of the asset. Read here to find about the new full version.
    3.0.1
    • Codebase updated to match the full version architecture.
    • Refactored connection data handling.
    • Refactored server responses to return pure json.
    • Added API methods for individual cell I/O.
    • Added localization example.
    • Added Editor Console log example.
    • Server script updated for better concurrency handling.
    • Added option for batch-creating objects.
    • Added option to UpdateObjects() for creating if not found.
    • Moved away from singletons for the connections.
    • Added prefab for simplicity of use.
    • API Reference is public now.

    [Public API Reference can be found here]
    [Full Version can be found here]

     
    Last edited: Oct 1, 2019
  2. blacklabgames

    blacklabgames

    Joined:
    Nov 7, 2012
    Posts:
    8
    Hi

    I've set up the Web service script as per the instructions, and the demo scene is working.

    When I try to get data from my own spreadsheet I get this as a response :

    2.792249 : <!DOCTYPE html><html><head><link rel="shortcut icon" href="//ssl.gstatic.com/docs/script/images/favicon.ico"><title>Error</title><style type="text/css">body {background-color: #fff; margin: 0; padding: 0;}.errorMessage {font-family: Arial,sans-serif; font-size: 12pt; font-weight: bold; line-height: 150%; padding-top: 25px;}</style></head><body><div><img src="//ssl.gstatic.com/docs/script/images/logo.png"></div><center>TypeError: Cannot call method "getDataRange" of null.</center></body></html>
    UnityEngine.Debug:Log(Object)
    <GetData>c__Iterator1:MoveNext() (at Assets/GSFU/Scripts/UnityDataConnector.cs:97)


    I followed the instructions in the PDF to set up the web service. Any ideas?
     
  3. blacklabgames

    blacklabgames

    Joined:
    Nov 7, 2012
    Posts:
    8
    Never mind, fixed it. The "security" sheet was called 'password' instead of 'passcode'
     
  4. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Thanks for contacting, glad you solved it! Hope it be useful.
     
  5. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Can you give API examples/workflow?
     
  6. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hi there. The workflow is based on a call to a webservice. You create a unity WWW connection string based on your requirements from the sheet. So your call will include a spreadsheet id, a worksheet name and a password, and it will return the data on that sheet.

    If you want to send data, is almost the same, except that you change some parameters, and include the data you want to send. Then the web service will append a row with the values sent, to the specified spreadsheet.

    The webservice script is deployed on your google drive, and is customizable as well (server side javascript), so you can simplify it, or develop a more complex scheme.

    The included example is trivial, but denotes the simplicity of use.

    Please let me know if this helps, or you wanna know more specific stuff.
     
    Last edited: Mar 4, 2014
  7. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
  8. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Sorry, Im not sure I follow your comment?
     
  9. casperjeff

    casperjeff

    Joined:
    Apr 13, 2013
    Posts:
    333
    Well, isn't this nifty....
    I'm tempted to buy it just to see what this element looks like.....
    Good on ya.....
     
  10. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    How would I use it from my code? You should download GoogleFu free and compare
     
  11. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    @casperjeff
    Thanks very much man! I faced a variety of options for doing this, and after some rewrites this approach definitively was the one that felt better, with the less burden on the Unity project. You dont need google APIs, nor dealing with authentication, and that really makes the difference on the interaction speed, specially when trying to send or retrieve multiple batches of small amounts of data.

    @imtrobin
    I think in my comment above I was descriptive enough, if you're wondering how a WWW call works in Unity look in the docs, is pretty straightforward. Be aware though, this is not something that will necessarily work on your project as-is. The included example showoff the typical implementation, but as with any external code, you will have to tweak it yourself according to your needs. Specially if you want to send data to the spreadsheet, you will almost certainly want to tweak the webservice code to expect the number of fields you want.
     
  12. Deleted User

    Deleted User

    Guest

    hi,
    I buy today.
    I followed the instructions in the PDF, abd change the sample scene with my own webservice and create the example sheets.
    The data in Balls spreadSheet if i change works. But if i rename the "Balls" spreadsheet to anything else don't work. Also the passcode is not working, works only with passcodehere and not with my password. Statistics spreadsheet also not receive any data.

    I'm in a hurry, and really need this working...
     
  13. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello emo55. Thanks for using GSFU.

    I received your email, but needed a moment before answering :)

    Sounds like you are changing the spreadsheet, but you're not changing the values in the gameobject in the unity scene. When you change the example sheet name, you need to also change the corresponding field in the scene "ConnectionExample" gameObject field in the Unity editor. The same goes for the password.
     
  14. Deleted User

    Deleted User

    Guest

    Hi,
    My ConectionExample gameobject have the changes... $Captura de pantalla 2014-04-16 a la(s) 18.38.02.png
    corresponding to my spreadsheets names in google drive
    $Captura de pantalla 2014-04-16 a la(s) 18.43.50.png
     
  15. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Im not sure I follow your interpretation of the manual. I think you're confusing Spreadsheet name with Worksheet name.

    What the Unity field expects as "Sheet Name" is the worksheet name, not the spreadsheet name. This is clear in the manual I think.

    You seem to have created multiple spreasheets, when in fact is one spreadsheet, with different worksheets (aka "sheets"). Again, this is clear in the example spreadsheet, and in the manual.

    Edit: I just received more emails from you, I do speak spanish, lets continue the conversation by email, I think the issue is that some things are getting lost in translation for you :)
     
    Last edited: Apr 16, 2014
  16. Deleted User

    Deleted User

    Guest

    Thank's, now works ;-) Las prisas no son un buen aliado ;-)
     
  17. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Glad it worked :)
     
  18. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    114
    I downloaded both and just reading the documentation there is one very big and key difference:

    GoogleFu is for Designer / build time
    GSFU is for runtime.

    So depending on your needs, ...
     
  19. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hey @crawfis, thanks for using GSFU! :)

    I'd like to clarify, that GSFU can be used at design time as well. I just did not inluded an example of that, but some users of the extension have walked that road.

    Should not be too hard to port the existing functionality to an editor menu, and create a local data file for use on the game later. It would be just a matter of using another loop structure in place of the coroutines.

    I will probably add such example implementation to the asset at some point. I just dont have the time at present.
     
  20. alexpoolton

    alexpoolton

    Joined:
    Nov 25, 2013
    Posts:
    6
    Just out of curiosity:

    1) What is the performance like, when pulling data? Would it scale for large amounts of data?

    2) Are there any security issues (man-in-the-middle or replay attacks) and is there anything in place to combat them? Or is this outside the scope of the projects?

    Thanks Alex :)
     
  21. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello Alex.

    1) Performance is affected by a number of things, so is not like I can give you an easy answer. But if your question points to the Google Drive performance on spreadsheets, I would say is pretty good. Although not sure what you define as large amounts of data, you can always try it by yourself on a google spreadsheet, and doing an export operation for example.

    2) Yes, there are security issues as usual. In this case, GSFU introduces an extensible approach, and offers the base case implementation, which means out of the box you have an acceptable security scheme for development. However it would need from tweaks to complete refactoring of the web service (depending on your needs), if the plan is to use it on released products.

    This is always hard to generalize without more specific info, and even then there are cases on which only experimentation will bring straight answers. I hope to have been of some help!
     
    Last edited: May 27, 2014
  22. VenomUnity

    VenomUnity

    Joined:
    Apr 6, 2013
    Posts:
    29
    Hello Novack,

    Can I use GSFU to create high-score for players and implement it in Android/iOS
     
  23. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello VenomUnity, yes that would be another good use.

    However same rules than previous question apply: it depends on the level of security you want/need. You can use the stock GSFU which is well suited for development cycle, and certainly some simple cases beyond that, or you can rework some things if want to improve how access to the spreadhseet is granted.
     
  24. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    how do I access the data from gsfu. Is it a array of strings or json or?
     
  25. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    It returns Json parsed objects, but you can modify de server side service if you need other output format.
     
  26. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    the json output is from googledocs or you converted them? Can you give example json?
     
  27. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Again, Im not sure what you mean. The webapp connects to the spreadsheet, and accomodates it into json format for output. The json example Im afraid, would vary depending on the info you have on the spreadsheet, so probably pointless to paste some random json here.

    Your questions are usually odd and not quite to the point regarding the GSFU funcionality. I insist that this is NOT an extension for someone not into coding, as you must understand at least the basics of the Unity API to use or tweak the included example in your favour.

    Other option is that you say what you need, so could be easier than guessing or blindly interpreting your quesions.
     
  28. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I don't see google spreadsheet has json output capability, and there's no fixed format for json. So what is the format? Is it just an array of strings? Can I deserialize it an .net object array directly or do I have to loop through the string array.

    I'm not sure why you inferred that my questions are newbie, I'm been programming games for 15 years. It's not clear how your API GSFU works.
     
  29. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    I was not trying to imply you're a newbie, but your questions -since weeks ago-, are kind of confusing, and I was not too sure what you are asking.

    I think at this point, the easiest way to go is that you try the extension for yourself. Check your inbox.
     
  30. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    thanks. Ok my tots

    You used a google app script to generate json. Interesting way. Googlefu downloads the spreadsheet and builds it from unity.

    I access it by array of strings e.g data ["col"]["row"]. That's what I wanted to know. I use newtownjson to map it to a class instead of parsing the array.

    You are able to upload data back into gdocs. Neat feature. I'm not sure of use case at this point though.

    I think it's helpful to put the doc in the assetstore link.
     
  31. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Thanks for your feedback @imtrobin.

    The example included actually has LitJson doing exactly what you mention as well, creating a client side object.

    Regarding the use cases for uploading data to Google Spreadsheets, the use cases are quite a number, and one of the features people like the most, but I guess you're speaking of your particular perspective or project.

    All in all, Im glad you find it useful, I hope it cleared all your questions.
     
  32. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Some News:

    Im working on an Unity Editor example use case for Google Sheets for Unity.

    People tends to believe that GSFU is of exclusive runtime use. Thats likely because no editor example is included or explained. Im going to try changing that, by including an extra example use case.

    Basically it will be based on the base example, but will also now work from an Editor menu, thus affecting the scene at design time.

    So the options for communicating with the Google Spreadsheet will be:
    • At runtime from the game itself.
    • At design time, from the editor menu.
    • At runtime, from the editor menu.
    All three options affect the scene, but the editor menu affects hierarchy assets (materials in this example case), so the changes can be persisted by simply saving the project).

    Im actually working on the manual changes and fixing latest details, so sooner rather than later it will be online.


    Will be raising the price on release, so grab it now if interested!
    http://u3d.as/6Lk
     
  33. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    New package has been submited to Asset Store, will be up once/if aproved.
     
  34. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    After a cold striked the Asset Store team (hope you feel better guys!), the version 1.2 is finally up!
     
  35. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Google Sheets For Unity joined the Asset Store Madness sale and it's available with a 70% discount!
    Grab the oportunity :)
     
  36. The_BenEvans

    The_BenEvans

    Joined:
    Jul 31, 2012
    Posts:
    139
    Loving this so far, can't wait to explore the full potential!

    Hopefully you can help me with this, I can only seem to send 2 values to the spreadsheet, adding a 3rd value by adding "&val3=" to the code returns a Bad Request 400 error. Is this a limitation with the Google API or am I doing something wrong? Not the end of the world if I can't.

    Keep it up!
     
  37. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello man, thanks, Im very glad you are finding it useful.

    Im not at my PC now, will check on this later today, asap!
     
  38. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    @The_BenEvans sorry for the late reply.

    Yes indeed you can add as many values as you need, as fas as you make the mods on both sides of the connection, client and webservice script.

    You need to send the extra value from Unity (in your case called val3, so using "&val3="), and the webservice script needs to know about the new parameter too, so add it to the parsing method. Is pretty simple to do, only remember that you need to create a new script version, and redeploy the webapp! (It does not work simply by saving changes on the script).
     
  39. wvickery

    wvickery

    Joined:
    Jan 27, 2013
    Posts:
    3
    I am trying to get the web service script as described in the instructions but i get a message saying that the page does not exist.
     
    Last edited: Aug 12, 2014
  40. The_BenEvans

    The_BenEvans

    Joined:
    Jul 31, 2012
    Posts:
    139
    @Novack No worries!

    I thought that might be the case, sounds easy enough :) Thanks
     
  41. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    @wvickery thats not the correct url. Oddly, is *almost* it, but not the correct one. You seem to accidentally have edited it. Simply copy the correct address from the manual ;)

    Oh, and please dont paste content from the manual here, I have not decided yet if making the manual public. If you need to ask something that requires that, contact me through email. Thanks!
     
  42. wvickery

    wvickery

    Joined:
    Jan 27, 2013
    Posts:
    3
    Hey mate, sorry for posting that. Didn't think about it.
     
  43. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    No problem man, I should have stated that before :)

    Let me know if you have any problems!
     
  44. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    2 days left for the Madness Sale!
    I wrote a Reddit thread about Google Sheets For Unity sale, if you're around pass by and upvote! ;)

    And remember Google Sheets For Unity it's available with a 70% discount for the duration of the Madness Sale.
    Grab the oportunity :)
     
  45. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Last Day! The Unity Asset store Madness Sale is coming to an end :)

    I will raise the normal price of the extension after the sale is over, so if you're interested, grab it now at the current price and 70% off!

    http://u3d.as/6Lk
     
  46. Mariol

    Mariol

    Joined:
    Dec 22, 2009
    Posts:
    42
    I'm having the utmost trouble with step 6 for some reason. I have connected it and it connects successfully to Google Drive. But I'm getting this error "TypeError: Cannot read property "parameters" from undefined. (line 15, file "Code")" when I try to go to the Run > doGet function to get the script authorisation dialog box. I haven't changed anything in the code here so I'm not sure why it's not working. Everything else seems self explanatory but I just can't get past this step. Please help :( If you need any more info please let me know.
     
  47. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hey @Mariol, you are not reading it all, or you have an older version of the pdf. Please look at the top of the manual, there is a link to its latest version. You'll find that it mentions about your situation: basically, you can disregard that error. That manual run is only to get the auth dialog for the web service.
     
    Last edited: Aug 18, 2014
  48. Mariol

    Mariol

    Joined:
    Dec 22, 2009
    Posts:
    42
    Thanks, I'll have another go later. I assumed I'm being special but thought I'd ask anyway.
     
    Last edited: Aug 19, 2014
    Novack likes this.
  49. Mariol

    Mariol

    Joined:
    Dec 22, 2009
    Posts:
    42
    @Novack So I guess I was using the most up to date version of the doc as I still get the same error. But as the doc says to ignore it I did so. When Playing the Test scene I keep getting the error "Data error: could not parse retrieved data as json." What's causing this issue?
     
  50. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    @Mariol There are a number of issues that may be causing that, but I need more detailed info on what you're doing. Please contact me through the support email.