Glide in not syncing automatically with Google sheets

Hi everyone.
I’ve made a Glide page that generate Images, I’m using Google sheet and App script. In my app script I have a function that generate automatically a link (image) for every row, whenever the cell “Prompt” is filled and the link is generated in the cell “Response” (same row).
In Google sheet, that take about 3 second and the link is generated. but in Glide, I should every time sync manually or wait at least 2 minutes to get the new link appear (I’m using Glide form to add new “Prompt”), I also have the Data sync mode on “Extra”. I need help Please
Thanks.

Here is some more information regarding data syncing. Even with Extra syncs turned on, Glide will only check for new data every few minutes. It gets tricky when you rely on scripting or formulas in the google sheet.

Out of curiosity, how are you generating an image. Just wondering if there is some way you could achieve the same thing within glide. Then you wouldn’t have to rely on data syncing from google to glide, and you could reduce your update/sync counts.

Okay! thanks for replying, I’m using a complex app script to send a Prompt request to “Open AI”, and writing back the result in same row. Is there a way to do this in Glide? and witch language should I use?

Or, Is there a way to play an action after 3 second?

Doubt it. I think syncing with google can get expensive and would be demanding on the server.

There is a javascript column if you want to use raw javascript. There is also an experimental code if you want to call external code. Both columns would allow you to pass in the prompt and return a result after processing through the code, so those are options. There are also plugin columns such as the JSON Fetch column, which allows you to retrieve data and parse it out. Something like that may be useful.

https://www.glideapps.com/docs/reference/computed-columns/plugins

3 Likes

I should try, thank you for the advice

1 Like

Hi,
I’ve tried the JavaScript column method, but is not giving any results, I’m not sure that I understand haw it is working, here is my code (API_KEY is meant to be hided):

fetch(‘https://api.openai.com/v1/images/generations’, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘Bearer API_KEY’
},
body: JSON.stringify({
prompt: “p1”,
model: “image-alpha-001”,
size: “256x256”
})
})
.then(response => response.json())
.then(data => {
// Extract the image URL from the JSON object
let imageUrl = data.data[0].url;

// Use the image URL to display the image in app
document.getElementById(“myImage”).src = imageUrl;
});

I replaced p1 with the prompt column

Since your moved the conversation to a new thread…