The situation
A larger number of companies (>100) must be shown in the app
An image of the company must be shown in list/title and detail views
Sometimes the list will be using circular images and sometimes square images
The detailed view could be using small, medium, large images of the company
Right now I’m using G-drive to host the images
In order to link to the specific image in G-drive then the image must be made sharable and the link copied to G-sheet.
The challenge
When you have to obtain a larger number of links and insert in the correct cells in G-sheet then you will end up doing the same thing again and again. This must be possible to automate - and I guess that some of the great people in the community could point me in the right direction.
NB: I want the images on my own account (and not directly upload to Glide) as I want to have the full control of the images whereabouts
If I wasn’t working with G-drive links, I would create similar names for the images and thereby easily create the links:
Company: X
Circular image: X_circ.png
Square image: X_square.png
Small image: X_small.png
Medium image: X_medium.png
Large image: X_large.png
I prefer the first of two answers on that page. Learning to script would take me longer than going out and taking all new pictures.
Yes, you can select all these files and get shareable links to them at once.
Select files
Right-click any of them and pick “Share…” out of the context menu.
Click “Get shareable links” in the upper right corner of the Share dialog window. This does several things at once: makes files accessible to anyone with a link, and copies the links to your clipboard.
Paste into the spreadsheet. The copied links are newline-separated, so when pasted into a spreadsheet, they form a neat column.
@Jeff_Hager Thx for input. I will consider whether I should start to take up scripting - know it will be useful in the future
@Les_Henderson Also thx for input. I might just do the simple version as you also preferred. Now I just need to find out how to get the names for the files - I wonder whether that is as easy as getting the urls - well, I haven’t figured that out yet. So any suggestions would be great
Did you get a screen to allow permission? I tend to stay away from scripts as much as I can, so I don’t have much experience with them. It’s more of an ‘I don’t want to learn them’ kind of attitude. I can do them, but they are time consuming. I don’t have much more info for you other that what I’m finding using google searches.
I found out that the following script can give the name of the file, url and more stuff.
Inspiration found here (but for some reason I couldn’t get it to work)
function listAllFilesInFolder() {
var folderId = 'xxx id of the folder xxx'; //id of the folder
var files = DriveApp.getFolderById(folderId).getFiles();
var sheet = SpreadsheetApp.getActiveSheet();
sheet.clear();
sheet.appendRow(["Name", "Date", "Size", "URL", "Download", "Description"]);
while (files.hasNext()) {
var file = files.next();
Logger.log(file.getName());
Logger.log(file.getUrl());
var data=file.getName();
Logger.log(data);
data = [
file.getName(),
file.getDateCreated(),
file.getSize(),
file.getUrl(),
"https://docs.google.com/uc?export=download&confirm=no_antivirus&id=" + file.getId(),
file.getDescription(),
];
sheet.appendRow(data);
}
}
@Krivo Take a look at this spreadsheet and the Google Script attached. Make a copy of it and place folder with other files in your Google Drive. You can run the function listAllFilesInFolder() in the Script Editor -or- I created a menu for it. [ Glide Community Demo Scripts/List all Files at this Spreadsheets Location] Do not rename the sheet at the script relies on it and will only overwrite data on that sheet name. You will have to allow it to run when you get those warning messages about it being a authorized google script.