2

Is there a way to import data into an app from Google Sheets that includes importing relations? The documentation I found mentions the following:

You can import all data in a Sheet into a model, adding the imported records to any records that are already present. The import process preserves any relations that exist.

If I select to import All Models and Relations data below, how do I need to have the Sheets file structured (in terms of column names, etc.)? How do I include the relations exactly? I have been able to import Single Model Data into App Maker easily, but am unclear how to do import All Models and Relations (see linked image below).

Here's the App Maker Import Data dialog I'm referring to

Carson Taylor
  • 45
  • 1
  • 4

2 Answers2

2

Two significant gotchas to this that it took me forever to figure out through trial and error:

  • The association of relations seems to be all or none. If you have a problem with one relation, none of them will process at all.
  • When it says "All Models and Relations data", it really mean ALL models. Even if you have models without any relations to worry about, or even without any active data in them yet, each one has to have a tab in your Sheet or the association of relations will fail.
  • Relations are required. In other words, if you have a situation like mine where you have a supervisor relation for an employee, you can't just leave the supervisor field for the CEO blank. A key for a valid relation item has to be present for every related field in every datasource, or the association of relations will fail.
Lynn Hoffman
  • 200
  • 11
1

Without digging into documentation and your data structure, I would suggest that your exported data format would be the same as your to import format should be. In other words you can:

  1. Populate your app with some records of each type with all possible relations
  2. Export your dummy data to spreadsheet to reverse engineer it
  3. Populate spreadsheet with your data in exactly the same format App Maker generated it on step 2.
  4. Import your data

You can try to immediately import exported data just to proof the entire concept and save some of your time.

Note

You cannot do all this magic for Preview, you need to have 'real' Deployment(s)

Pavel Shkleinik
  • 6,298
  • 2
  • 24
  • 36