contact-research-network / webpage

MIT License
0 stars 2 forks source link

Create announcement section with excel sheet #3

Closed psyprofmichele closed 3 weeks ago

psyprofmichele commented 3 months ago

Create an announcement section that can be updated via an excel sheet. For this identify how an image can be displayed via an imageurl.

LukasWallrich commented 3 months ago

Image download from Google Drive might work like this - if so, that would make it easy to include pictures: https://stackoverflow.com/a/39225272

@psyprofmichele already created a template spreadsheet: https://docs.google.com/spreadsheets/d/19ylN6fWPO_aMLx9pPBacXodXKEih42iNmceInhMT6Zg/edit?gid=0#gid=0

psyprofmichele commented 3 months ago

ChatGPT solution - I have added these links I created to the excel sheet:

Step 1: Convert Google Drive Links to Direct Download Links

  1. Get the Shareable Link:

    • Open the Google Drive file.
    • Right-click on the image and select "Get link".
    • Ensure the link is set to "Anyone with the link" and copy the link.
  2. Extract the File ID:

    • The link you get will be in the format: https://drive.google.com/file/d/FILE_ID/view?usp=sharing.
    • Extract the FILE_ID part from the link.
  3. Create a Direct Download Link:

    • Use the following format to create a direct download link:
      https://drive.google.com/uc?export=download&id=FILE_ID
    • Replace FILE_ID with the actual file ID from your Google Drive link.
LukasWallrich commented 3 months ago

That link does not work inside an HTML file (as ChatGPT claims) - but can be used to download. E.g, with this code:

library(httr)

# Define the URL and destination file path
url <- "https://drive.google.com/uc?export=download&id=15Gs3ZWBROhsATHUGp8_K9RefR1KN9d_O"
destfile <- "downloaded_file"

# Download the file
GET(url, write_disk(destfile, overwrite = TRUE))

# Check if the file is downloaded
if (file.exists(destfile)) {
  message("File downloaded successfully.")
} else {
  message("File download failed.")
}
LukasWallrich commented 3 weeks ago

Never closed this - but it now works from the URL above