AppScript

Hey,
does someone has experience with glideapps and appscript?
I want for example sync my complete table in glideapps with google sheets.
Does someone know how that works?

Best
Andi

Do you have a Business or Enterprise Plan?

I have business

Okay, it’s possible using the Glide API.
Essentially you would need to write some code that iterates through each table, fetches the data for the table via the API, and writes it into your Google Sheet.

If you’re not familiar with Apps Script, you might find this easier with an integration tool such as Make.

Hey Darren,

thanks for your reply. I have the problem, that I am not sure how to convert the data.
In my code I am only able to export “ALL DATA in JSON FORMAT” and it lands then in ONE FIELD in Spreadsheet. But I think I am just wrong in understanding how the data is coming through the API.

Look this is the code I am using:

  // Überprüfe, ob das "rows" Array vorhanden ist
  if (responseData && responseData.queries && responseData.queries[0].rows) {
    const rows = responseData.queries[0].rows;
    const headers = Object.keys(rows[0]); // Kopfzeilen aus den Schlüsseln der ersten Zeile extrahieren
    const data = rows.map(row => headers.map(header => row[header] || '')); // Daten für jede Zelle extrahieren

    // Kopfzeilen und Daten ins Sheet schreiben
    sheet.getRange(1, 1, 1, headers.length).setValues([headers]); // Kopfzeilen
    sheet.getRange(2, 1, data.length, headers.length).setValues(data); // Daten

Do you have an info, what I am doing wrong here?

Beside that I have detected another problem with the api. As I sayd, I have a business account. In one of my databases with multible columns I see, that I can just receive approximatly 20. So if I try to send a request over zapier for example I just receive a limited amount of columns. Do you know why?

You can fetch directly using the JavaScript column without any limits or third-party integrations.

I believe the problem is with your very last line. You are operating on data, where you should be operating on data[0].

I’ve never seen that, perhaps it’s a limitation of Zapier?
Keep in mind that only non-computed columns are available via the API.

Hey, how do you mean that? Also when I klick on GlideAPI / JavaScritp I see under columns just listed a view and not all of the columns I have in the database…

here as a sample that you see that I am talking about the right code:

 erstelltAm: { type: "date-time", name: "Y4lDo" },
        gptAntwort: { type: "string", name: "oN6tD" },
        briefingFile: { type: "string", name: "1pbBN" }
    }

Best
Andi

Bildschirmfoto 2023-12-27 um 10.42.41
For example the column “Bearbeiter” should normally be visible as you see in the screenshot - its standard text. But its not in the list of java script columns and also über the other API Codes I can not find it. Do you have an idea?

No, I can’t explain that.
If you don’t see it under Show API → Add Rows/Edit Rows, then you might need to submit a support ticket.

Hey, could it be that the behavior is different with the user table compared to other tables? Cause I am now able to import data from a standard table… but when I try to do it with the user table it is fomated completly wrong / different. (the whole answer in one field)