Hey, I’m new to working with APIs and trying to read through documentation and go through tutorials. I’d like to make sure what I’m trying to do is technically possible.
I have a Glide Table that is storing images. I would like to pull the data from the Glide Table into a Google Sheet so that I can use the Image Key from the Glide Table as validation criteria for the sheets that have columns to reference the images.
Is it possible to use Google Apps Script to use the “Get All Rows” API Instructions provided by Glide when you right click on the Table to do this?
Yes, you can manipulate data in Glide Tables via the API using Apps Script.
It’s not as simple as copy/paste though, if that’s what you are asking. You actually need to write a bit of code
Yes, I figured out that copy/paste doesn’t work haha. But I just wanted to make sure that my scenario was possible before I spent a lot of time trying to figure out how to get it working. I have a very basic understanding of JavaScript, so I need to spend some time working on it. Thanks!
Thanks for the head start. I believe I have the API call working correctly now.
Now I’m trying to pass that data into the Google Sheet. I tried following a YouTube tutorial, but it didn’t quite match up.
I believe this part is working correctly and it gives me a menu option to run the Script:
function onOpen() {
let ui = SpreadsheetApp.getUi();
ui.createMenu('Glide')
.addItem('Display Glide' , 'get_all_rows')
.addToUi();
}
However, I’m having trouble with the last part. So far I have this:
let sheet = SpreadsheetApp.getActiveSheet();
let glideRows = [];
glideRows.push(data.name);
let glide = [];
glide.push(glideRows);
let targetRange = sheet.getRange('A2:G');
targetRange.SetValues(glide);
I don’t know if I need to individually reference each column value using .push to insert each one, or if it can be something more generic to simply return everything.
I had only typed out one because I couldn’t figure out the correct naming scheme.
I suppose I don’t actually need the data from all 7 columns, I just didn’t know if I had to pass all of it along. I really only need the data from the first column. The column name is “Name”, but I didn’t know how to properly reference that.
Is it okay to do something like A2:A since I don’t know the exact number of rows, but I’ll always want all of them?
I’ll play around with it some more, but I’ll probably just need to get my friend that knows JavaScript well to help.
Do you know of any good tutorials on the basics of integrating Apps Script with Google Sheets?
I’d like to learn it more in depth eventually, but I don’t have time to learn JavaScript from the ground up at the moment.
No, that won’t work. You need to select two-dimensional array (range) that is an exact match for your data. But you can determine that by using data.length.
There probably are, but I none that I can recommend.
Personally, I just taught myself by referring to the docs.