How to create a shorcut to a spreadsheet file?

Greetings to everyone reading this. I’ve created a .desktop file with the contents below, put it in the folder .local/share/applications, and made it executable.

[Desktop Entry]
Name=My Spreadsheet
Comment=Shortcut to My Spreadsheet
Exec=/home/host/Documents/myspreadsheet.xlsx
Icon=libreoffice-calc
Terminal=false
Type=Application

The spreadsheet icon shows up in the Gnome applications and it can even be pinned to the dash, but when the icon is clicked, nothing happens or opens.

If I run the command below in the terminal, the spreadsheet opens:
libreoffice /home/host/Documents/myspreadsheet.xlsx

Does anyone know, how to make this work?

1 Like
Exec=xdg-open /path/to/file

That should use the app associated with the specified file type.

2 Likes

That worked, thank you Vladislav! For learning purposes, I’d like to ask you, how come xdg-open had to be added for it to work? Is it because it’s a file, and not an application?

1 Like

Yes, the Exec key requires an executable command:
The Exec key | Desktop Entry Specification

2 Likes