How to add hotlink to QGIS? I saw this but had some problem. I want to open network location like \\fileserver\filefolder\file1.excel but it ends with error.

Edit: The network location is stored in a column of the table eg. URL column contains URL value for each attribute. Different row has different URL.

  • 1
    It would help if you could describe the error. – sgrieve Sep 7 '12 at 7:44
  • @sgrieve Unable to run command. I actually have stored the location in one of the column and I have used it has an expression. – kinkajou Sep 7 '12 at 8:19
  • 1
    Maybe you need to prefix it with file:// or local://, since it is not directly on one of your disks. I imagine dos batch commands will have trouble interpreting that though. – lynxlynxlynx Sep 7 '12 at 8:30
  • @lynxlynxlynx still same error :( – kinkajou Sep 7 '12 at 8:41
  • 1
    On what OS are you using QGIS? – Giovanni Manghi Sep 7 '12 at 8:46

This way it works for me on Windows and Qgis 1.8.0:

Create a point shapefile with a field url of type string. Add a point and fill the url field with


without any blanks or quotation marks unless you have blanks in folder and filenames. Don't forget to save the layer, end leave edit mode.

In the layers properties, create a new action of type Generic , name it open and add

cmd /c [% "url" %] 

as action.

Select the Action icon, move the mouse over the point and click to open the excel sheet. The Excel sheet should have the standard .xls extension.

| improve this answer | |
  • tried it but my path has space i.e. my file name has space "test test12.xls" it opens a command window and nothing happens – kinkajou Sep 7 '12 at 12:00
  • 2
    It might work if you put the whole path inside quotes. Just guessing though. – Rayner Sep 7 '12 at 12:33
  • 1
    Just tested: "\\fileserver\filefolder\file 1.xls" (with the quotation marks!) in the shapefile field works. – AndreJ Sep 7 '12 at 12:35
  • Glad I could help. Please vote my comment up if you think it was useful. – Rayner Sep 7 '12 at 16:45
  • @Rayner its helpful but my url is one of the column of table – kinkajou Sep 9 '12 at 9:47

I'd use python. After reading a blog post from Tim Sutton at linfiniti [1] I learned you can use python in actions:

eg something along those lines:

from pywin32.client import Dispatch
xl = Dispatch('Excel.Application')
wb = xl.Workbooks.Open('C:\\Documents and Settings\\GradeBook.xls')

taken from another post [2]

[1] http://linfiniti.com/2012/03/a-python-layer-action-to-open-a-wikipedia-page-in-qgis/

[2] https://stackoverflow.com/questions/247724/how-can-i-launch-an-instance-of-an-application-using-python

| improve this answer | |
  • 1
    I don't know if it is excel or pdf as I have mentioned in the question it can be pdf or any other file too. I use it with mapinfo currently. It's easy in Mapinfo but I am not able to find this feature in Qgis easy. – kinkajou Sep 10 '12 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.