Copy-paste Gsheet/Excel columns to Variables or Arrays in Gdevelop [SOLVED]

As a feature in Gdevelop, I really need an easy method to copy-paste excels columns to array variables. I have a list of names in a sheet and want to add it directly as arrays so that I can make a random picker generator for my game but I don’t want to copy-paste each name to each child variable individually; I want to simply copy-paste it and BOOM it’s set.

If there is an easier way to do this or an add-on I can get, let me know! otherwise, please add this feature to Gdevelop :pray:

If you just want a random word then you could leave it in one variable and then use various FindStr() expressions to find a random word by searching for the NewLine() before and after a random number.

Hello @TheFirst0ne
I suggest you to

  • put one variable value
  • close GD
  • create a json backup
  • open the gdevelop json project file and edit it with notepad (or similar).
  • research the variable value
  • copy and paste the values
  • save and close
  • finger cross and open gd again

Search on Google for converting excel data to the JSON format that is accepted by GDevelop. :slight_smile:

It’s been a week since I last checked this and, looking at all the answers, I found a working solution thanks to your suggestions.

  1. I found an online converter that transcripts excel data to JSON (you can just search ‘excel data to the JSON Array format converting’)

  2. Looking at how the format works I made my excel file look like this.
    Screenshot 2022-11-25 151623

  3. Next I saved the excel file and I uploaded it to the online converter. It should look something like this.

  4. Open your Gdev JSON file using notebook or a coding software then find your variable values and copy paste it to replace or add.

  5. Save the JSON file and run it in Gdev. It should work because mine did!

Thanks to those who helped!

5 Likes

Hey @TheFirst0ne,
Would you be interested in creating your first Wiki article for GDevelop explaining how to import?
You’d have to demand access by clicking on the “code” black button:
Screenshot 2022-11-30 at 14.34.14

Doing so will grant you the “Wiki contributor” badge once the article has been published.

You’d be doing it here: gdevelop5:tutorials:how-to-import-a-google-sheet-in-gdevelop [GDevelop wiki]

ooh I am interested but I’ll probably try to work on it around sometime next week

Is this a suitable topic for the wiki? It involves modifying the game.json in a test editor, and any mistake will render the file unloadable. Unless the dev saves a backup first and can resort to the last working copy if errors occur, it’s an activity that liable to end in tears for some Gdevelopers.

I think it would be better and safer to create an extension that reads in the json file with the data and populates the array/structure with that data.

2 Likes

Hi @MrMen , just a question:

Isn’t it what can already be done by:

  • reading a .txt file from computer and put it in a variable “myvariable”
  • Parse JSon string “myvariable” and store into…

Just out of curiosity. Because I do this sometimes, using the Parse action, and I never have to directly write it inside the game file.

Yes, it would. I was thinking of a grid of cells, which is a bit more than what the OP asked for I guess. I don’t know if the parsing would handle that.

1 Like

Feel free to discuss which is the best way to do so, and if you’re willing to code that extension, that would be lovely.
The reason why I liked the 1st approach is because it was also suitable for non technical users (copy /paste is a universal language :sweat_smile:), but if installing an extension could solve this, that would be the gold standard.

Solved topics on the forum will start migrating to the Wiki. We want the Wiki to become the most reliable source of truth. The objective is to test adding an in-app search on the Learn section and get information from the Wiki.