View extrernal image in a cell with Calc

Now I have a number of pictures of faces, a file Database_FB.odb and another file hyperlinks.ods in the same directory (Headshots).

Database_FB.odb - a good example of how a database can be used.

What am I expected to see / do in the last file (hyperlinks.ods)?
I can’t see any images? (only the correct path - J3 and filename and sheet in J1)

In my case, I have no control over what I received - a document in .xlsx format.
And I want, if possible, not to buy MS Excel for this. :smile:

You asked for clickable links. My formulas create clickable links.

I have resigned myself to having Excel for stuff like this.

Unfortunately, this function of Excel is used in quite a few business reports that I have received, and continue to receive, from various information providers, and so am faced with a similar problem.

It also means that you won’t be able to modify it in Calc and send it back to whoever first sent it to you without corrupting it, if ever that was your need.

Obviously, the import filter isn’t perfect, and this is one such instance.

In this case, the solution was as follows:

  1. The .xlsx file was opened in Calc. (the original file)
  2. The content was exported to a temporary csv file.
  3. Everything was cleaned out in the csv file, (with Notepad++) except for the image links (http:// addresses)
  4. The temporary csv file was opened in a new spreadsheet (Calc)
  5. From this csv file, the http:// addresses of the original file were copied into a separate column. (then I can see the addresses)

Now it became possible to carry out the previously described steps

  • Copy .: the link itself (http://…).
  • Select .: Insert > Image
  • Paste the link in the “Archive” field.
  • Check the “Link” option.

And do this for all addresses (about 400)

In my case, I wrote a simple program in Autohotkey, which in any case performed each step of the sequence automatically.
The cell with the http address was highlighted and I pressed WinKey+n (and waited)
The program would have become more complicated if everything happened automatically.

#Requires Autohotkey 2.0
#SingleInstance Force

#n::
{	Send "{Ctrl down}c{Ctrl up}"
	Send "{Left 7}"
	Sleep 100
	Send "!I"
	Send "{Enter}"
	Send "!n"
	Send "{Tab}"
	Send "{Ctrl down}V{Ctrl up}"
	Send "!Ö"
	Send "{Enter}"
	Sleep 1000
	Send "!B"
	Send "{Enter}"
}

Since the images were of varying sizes, they could overlap. That meant I also wrote a small AHK program to handle the image sizes in Calc.
It was a bit more difficult to manage because the image had to be selected (not the cell the image was attached to)

#Requires Autohotkey 2.0
#SingleInstance Force


#n::
{	Click "Right"
	Send "{Ctrl down}oo{Ctrl up}"
	Send "{Enter}"
	Sleep 100
	Send "{Alt down}H{Alt up}2,5"
	Send "{Alt down}O{Alt up}"
	Send "{Up}"
}

In my case, I’m not interested in being able to “return” the images to the sender.
My wish remains, to either be able to see the image by clicking on a link

  • or to see the image in the spreadsheet (which in this case was better).

As this feature is not built into LO Calc (currently)
Are there only a few options. (as I see it)

  1. Is it possible to do this through an API to Calc? Where is information about this? (have written programs that handle both text and cells in Calc - but not this)

  2. To write a more automatic script, similar to what I did. (writing a macro is maybe possibly - but I feel unsure how to handle problems)

  3. ???

  4. Switch to MS Office… (which I want to avoid - if possible)

Thank ypu! (Didn’t see which column was “clickable”)
Although these examples do not solve my desire in this case, two inspiring examples are supplied
(I think the database example is better)

What keeps me from database solutions, is that I haven’t found the tools (eg suitable APIs)
But that is another question.

The one with cell style “Hyperlink” (blue, underlined font).

Most of my samples do not contain a single line of macro code. Databases are prepared to deal with text and images.
Database_Calc.odb (1013.3 KB)
If you copy the attached database document into my “Headshots” directory, you see how Base can deal with spreadsheet data containing names of picture files. The document contains a form and a report.

Thank you! (Think it’s good to stay away from macros, if possible)
When I try to view the result from the latest database, I got an error message
No table with the name "DBRange

Sorry, I forgot that I modified something important in the spreadsheet. Open it, select the list range with the gray headers, call Data>Define and give name “DBRange” to the selection. Save, close, restart office suite. Now the database has the proper table references to that database range.

This thread any use?

I see someone created an extension:

1 Like

Sorry - I don’t understand…
I open the database file Database_Calc.db but, what to do then?
Is the database DBRange? - under “Formulär” (on swedish) (form on english?)
If I open DBRange - under “Report” I got many errors.

No, open the spreadsheet instead, then continue as described in

Edit, save and close the spreadsheet. Or replace it with this one where I already made the change:
hyperlinks.ods (26.7 KB)

Yes! Now it works. (nice)

This is starting to drift a bit from the basic question, but it’s interesting.
The database starts to get more complicated with a number of relational tables.

When this database was created.
How was it planned?
Are all the values ​​manually entered?
or did you do the structure first and then some kind of import of all the information?

Thank you!
Yes! It works (The little I have tested) :nerd_face: (but take some time to do)
Next time I try again

There are data generators on the internet, such as RNDGen

Yes - to create the source information, but not all information should go to the same table.
RNDGen generated random information to a csv file (or ??? - format)
How was that information read into LO Base? (import table for table or all tables at the same time? or manually)

It is always best to design the empty database tables, indices and relations first. For one-off operations, I copy from Calc and paste to the Base table icon. Invalid data (incomplete rows, wrong types, duplicates) raise errors and don’t get into the database. Pasting arbitrary sheet trash into Base and then trying to get the structure right is cumbersome.
For regular csv import, such as bank accounts, I use prepared HSQL text tables together with SQL views and a fairly simple Basic macro. This is by far easier to do than with Calc, as long as the csv structure does not change.

1 Like

_xlfn means, that it is a function that is unknown to LibreOffice. In this case it is the Image function IMAGE function - Microsoft Support.

You can try this: Copy the link itself (full https://…). Then go to Insert > Image and paste the link into the “File” field. Mark the option “Link”.

Yes! it works. (thank you!) the image is inserted in a cell.
Is it possible to write a formula to do this automatically?
I can export the .xlsx-file to a csv-file and pick out the urls.
But how to activate all these URLs automatically?