Search Unity

[RELEASED] Google Sheets For Unity

Discussion in 'Assets and Asset Store' started by Novack, Jan 19, 2019.

  1. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Wow @Gr33nIguana that was intense to read :D
    Great work on elaborating your case!

    So, I understand the problem. The reason of the issue is that you're telling the api to update objects searching for a field that contains non-unique values, so the result is the expected (as you already stated), it will look for all rows containing that value and update them.

    But the problem goes a bit beyond that, because in fact, you dont have any sort of unique value to identify individual rows, so it wont be possible to point which specific rows you want to update.

    The trick here would be to add a new field, usually the first column, with an id. The only requirement for it is to hold a value unique to the table. Then, assuming that your new unique-value field is named "id", you can use something along these lines:
    Code (CSharp):
    1. Drive.UpdateObjects(_tableName, "id", idValue, jsonPlayer, false, true);
    Hope it makes sense.
     
    LaurieAnnis likes this.
  2. Gr33nIguana

    Gr33nIguana

    Joined:
    Feb 24, 2011
    Posts:
    14
    @Novack thanks for the fast reply :)
    I have followed your advice and added a new unique name to each test. It now works as intended, I can create new rows and find / update any previous one's by using the unique id. Thank you for thelp :D
     
    Novack likes this.
  3. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Very glad to hear! Thanks for letting me know, good luck!
     
  4. mjamie

    mjamie

    Joined:
    Sep 4, 2017
    Posts:
    11
    Hi Novak, Really love this Asset.

    I was just wondering if it is possible to upload videos? I have attempted to and it has worked with the create binaryfiles. The problem comes when I try to upload a large file of 60mb it does not work. Give an error saying files are to big. Unity build also does freeze. My build is on webgl and does give an memory access out of bounds. On editor it says the files are to large. Think you could help me with this. Thanks.
     
  5. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hey @mjamie thanks for contacting and the kind words :)

    Im afraid Google has a maxium post request size on the webapps, that -last time I checked- was about 24Mb.
    Hope it helps.
     
  6. gekidoslair

    gekidoslair

    Joined:
    Sep 7, 2012
    Posts:
    128
    Hey there,

    I'm trying to build an editor window to manage the google sheets, and I see an 'editor example' listed in the docs and screenshot on itch, but I don't see it in the actual package after loading it into my project? Am I missing something?

    Thanks in advance
     
  7. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @gekidoslair thanks for contacting.

    The editor example, should be available in your project as part of the package, inside the examples folder. Maybe you did not imported that folder? Safest bet, remove and reimport the package, it should be there.


    Have a great new year everyone! :)
     
    Last edited: Jan 4, 2022
    LaurieAnnis likes this.
  8. gekidoslair

    gekidoslair

    Joined:
    Sep 7, 2012
    Posts:
    128
    strange. i've redownloaded and imported a few times, will try in a clean project and see. Thanks & happy new year!
     
  9. FeboGamedeveloper

    FeboGamedeveloper

    Joined:
    Feb 2, 2014
    Posts:
    47
    Hi I can create sheet with charts via scripts in unity? Because I must do statistics with my data player!
     
  10. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @FeboGamedeveloper!

    You can have charts on your sheets (they wont interefere with GSFU), but you can't actually create charts or manage them using the stock asset. The idea is that you use the sheet as a self hosted small database, but any post-process over the data is not considered as part of the feature set, as it most often isn't. So long story short, you'll need to create the charts yourself.

    Alternatively, you can implement it server side, on the webapp service, but I dont think is worth it, given that charts specs change often, and are very simple to implement.

    Hope it makes sense!
     
  11. merrythieves

    merrythieves

    Joined:
    Apr 28, 2021
    Posts:
    14
    I am receiving this error: Cannot find CloudConnector script on scene, cannot execute the request.

    It works in the editor, but not on Android.
     
  12. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @merrythieves,

    That is a very old version of the asset, no longer supported. You can download the latest version from your account at the Unity Asset Store!
     
  13. Freak

    Freak

    Joined:
    Dec 14, 2016
    Posts:
    2
    Hi!
    Is it possible to parse such table with your asset?

    Screenshot 2022-05-19 at 20.29.44.png
     
  14. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hey there @Freak thanks for contacting,

    Yeah that looks simple enough, but instead of having merged cells, you'll need to split them and duplicate the value, to make it more database-like.
     
  15. vrgz

    vrgz

    Joined:
    Apr 20, 2011
    Posts:
    34
    hello

    can you help me with new google sheets setup?

    Google sheets and plugins manuals look different and can't be found Spreadsheet Id,Service Password

    and can't find server side app like setup “”pass code”.

    maybe help me a new operate video tutorial.
     
  16. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @vrgz thanks for contacting.

    There should be no difference whatsoever obtaining the SpreadsheetId. Please contact me to the support email, and please clarify what version of the Google Sheets for Unity have you purchased.

    Cheers.
     
  17. Trouler

    Trouler

    Joined:
    Nov 3, 2016
    Posts:
    4
    Hi @Novack!
    I'm having some issues with CreateImageFile, where the URI becomes too long and Unitys web clients kicks back at me. Even your demo scene for images has this issue if you first load the PNG from local file and then try to save it as PNG.
    Is this the only way to send images to Google Drive? Is there no way to bypass and send the data in a body instead?
    Loving the asset btw <3

    Kind regards,
    Trouler
     
  18. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @Trouler thanks for contacting! And thank you for your kind words :)

    Can you write me by email and send me some details about this case? I've not had direct experiece with somethign like that, so having some further info would be pretty useful. So if you can describe a bit more in detail what was the intent, and where/how it failed would be awesome. You describe a repro case with the example, but Im not entirely following what you mean, so just a bit more detail would be great, in order to be able to help you. The email is the support address described in the dev guide.

    Cheers!
     
  19. Trouler

    Trouler

    Joined:
    Nov 3, 2016
    Posts:
    4
    Right, I'll throw a mail your way :)
     
  20. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    @Trouler sent you an email buddy! :)

    General reminder, if anyone is using GSFU for file handling, remember to set your connection data asset to use POST request method:
    upload_2022-9-4_10-30-45.png
    Have a nice sunday everybody!
     
    Trouler likes this.
  21. Rand_D

    Rand_D

    Joined:
    Oct 24, 2017
    Posts:
    44
    Hi @Novack ,
    I purchased the Unity Lite version from Unity asset store. Can you update the tutorial for the new interface of Google App Script ? Google is about to end the old interface soon. For the new interface I havent figured out where to put all the correct settings yet.
     
  22. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @Rand_D thanks for contacting.

    Yes I will update the dev guide to the new procedure, however I was waiting for Google to settle down and implement all the required features, something that aint gonna happen on our lifetime, apparrently.

    So I will schedule the update at some point in the near future. In the meantime, please contact me by email (the one for support on the dev guide). I will gladly guide through the deployment. Please include your invoice number if you are so kind.

    Cheers!
     
  23. Hypertectonic

    Hypertectonic

    Joined:
    Dec 16, 2016
    Posts:
    75
    Hi @Novack thanks for the asset, got it running in a few minutes after a whole week of suffering with Google's REST API and .Net libraries and ultimately learning they will never work on WebGL.

    I found when using the spreadsheet sample code that it constantly gives out an error:
    Code (CSharp):
    1. ERROR: A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.
    2.  
    It was a simple fix in DriveConnection.CoExecuteRequest to just dispose the web request at the end of the method.

    Another thing, I know the samples are samples but I'm sure lots of people just use them as-is... It would be nice if it there were a tiny docs about them, even if just in the code. In particular in the spreadsheet, there were some things that were not immediately apparent:
    - Creating new rows always happens at the bottom, ignoring the range. (This is a good thing, just unexpected)
    - The name of the sheet is expected to be the same as the Type of the object.
    - Object property names must exactly match the fields in the sheet

    That last one is a bit of a problem as often the Type's properties might have different casing due to code standards or have names change due to refactoring. In Newtonsoft Json there is a [JsonProperty] attribute that allows you to explicitly set the name to use in the JSON. Is GSFU using Unity's Json? It's a minor nuisance.

    Finally, is there a recommended way to wait for the response? It seems the entire API is synchronous.
     
  24. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @Hypertectonic I completely forgot about your comment, apologies! I will get to this later today as soon as I can.
     
  25. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Oh right, finally got the moment to sit and answer properly!

    Regarding the "Native Collection has not been disposed" error, yes I know about the issue, its an old issue but recently Unity started to report it to the console. Thank you for patching it yourself, is among the priorities to be polished.

    Regarding your feedback, is much appreciated, I will have in mind to provide some technical details on the examples.
    Also, indeed, the sheet name and column names must match the type and field names. I wanted it to be as plain and simple as possible. However, maybe the simplicity can remain as the default option, while the asset could perfectly offer more flexibility for those that need it! Will keep it present for future improvements.

    I didnt quite understood the point about added rows and ranges, would you elaborate a bit?

    Finally, of course the asset is not synchronous, that would be quite painful :)
    You need to suscribe to the events, look at Drive.cs there are both "responseCallback" and "errorResponseCallback", but following the examples code you will be able to track the entire data flow.

    Hope it helps @Hypertectonic !
     
    Hypertectonic likes this.
  26. Cave2137

    Cave2137

    Joined:
    Jan 23, 2018
    Posts:
    14
    upload_2023-6-6_4-43-34.png

    Is it possible to make it work with offline sheets? @Novack
     
  27. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Thank you for contacting. Im afraid nope, the speadsheet could be available, but the webservice that works as interface, will still be online only.
     
  28. Webbstre

    Webbstre

    Joined:
    Mar 7, 2015
    Posts:
    41
    Hello! I'm curious if this will allow me to save data from multiple users using the app to a private spreadsheet of my own.
     
  29. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello @Webbstre thank you for contacting.
    Yes, that is precisely what it does :)
     
  30. Innopeaktechnology

    Innopeaktechnology

    Joined:
    Feb 7, 2020
    Posts:
    2
    Hi Novack
    What happens if there is more than one user editing the same sheet table row at the same time?
     
  31. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello there. Concurrency is considered and covered by the asset, through Google Webapp side, although with some hard limitations based on the service provided by them. In practical terms, is a safe spot, as projects hitting those limits are going to require more conventional backend solutions anyway.
     
  32. Innopeaktechnology

    Innopeaktechnology

    Joined:
    Feb 7, 2020
    Posts:
    2
    Hi Novack
    Is it possible to upload the image to Google Drive and insert it into a cell just like the 'Insert' menu does?
     
  33. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Hello there, thank you for making contact :)

    Currently with the full version you can create and retrieve images from Google Drive. Inserting them in the spreadheet was planned, but never got time to implement it. You could however, create or upload the image and use its id in one of the fields. Not quite the same, but still available on the table from Unity.

    Hope it helps!
     
  34. tapped_rupert

    tapped_rupert

    Joined:
    Oct 27, 2020
    Posts:
    4
    Hello.
    I am getting a response:
    Code (CSharp):
    1. Undefined server response:
    2. TIME_OUT
    I am seeing the Execution come in on the AppsScript page. If I change the password to in incorrect one, I get invalid credentials error, so it seems to be hooked up correctly. Any ideas?

    I am using this in Editor, not at run-time, if that makes a difference?

    *EDIT* Turns out the CSV I was loading was a little too large for the default 15 second timeout.
    It was 30 pages filled with game balancing.
    Set 60 and it works now. ;)
     
    Last edited: Nov 2, 2023
  35. Bogu-94

    Bogu-94

    Joined:
    Dec 11, 2013
    Posts:
    58
    Woah, glad to see that the developer is still answering here. I found @Novack 's itch.io and the last comment is from 1y ago. so I was kinda worried I won't get support.
    Idk why google sheet -> unity isn't built-in already, even though they have it in Unity Localization.
    Before I'm buying can I get some clarification?

    Right now I'm using a sheet csv parser from someone in github. it works really well, but not for my case.
    upload_2024-1-19_15-57-34.png

    I'm creating a dialogue system that looks like this, but this free github package has some problems
    - it requires the 2nd row empty.
    i can hide it, but i prefer it doesn't have to be like that
    - any commas will break parsing.
    i can add double quotes to fix it, but the game will be at least 100k words with 6+ localization. i can already imagine all the human errors. and i haven't find a way around to auto add double quote inside the code.
    - column A must be unique, which is kind of dumb
    + the plus side of this package is that it only requires sheet id and grid id. no setups / api / auth needed.


    Now, about your GSFU package
    - can it fix my problems above?
    - can it run on mobile? (needed for the translator to check the changes immediately)
    - some GS->Unity causes an error when there's a filled cell somewhere (say it's in Z2000). is it a problem too in GSFU?
    - can it handle \r\n inside a cell and not break it?
    - can i directly access a cell to get value from, say "sheet2!A1"?

    Thank You.