5

I need to use the XYtools plugin to read an Excel file. After choosing the XYtools incon and indicating an Excel file to read in, a message appears "there is a problem with loading a python module which is needed to read/write Excel files. ... see documentation/help on how to install the xlw and xlwd libraries." I found the site where the Python items reside but I cannot understand at all what to do next. Apparently the needed Python libraries are not installed with XYtools. I would appreciate being pointed to somewhere that might give some help with exactly what to do to get XYtools to work with Excel files.
Thanks -

0

4 Answers 4

5

To continue the suggestion by Alister on the qgis-users maillist, since you've installed using the OSGeo4W installer, then just

  • rerun the osgeo-setup.exe, and choose "Advanced Install" in the first window.
  • Click Next->Next a few times till you get to the "Select Packages" window.
  • Here you click on the '+' in the Libs section to open the full list. Scroll down to find the python-xlrd and python-xlwt packages, and select them to be installed (click on the double cirular arrow symbol).
  • After it finishes, open QGIS, and try the XYTools plugin. Should be OK...
5
  • That worked! Thanks a lot! I can read in the Excel file.
    – HealthMaps
    Aug 12, 2012 at 8:13
  • When the Excel file was read in with XYtools all the columns that were numerical in Excel are text in the temporary layer. This seems to be a real downside to QGIS to read in numerical data as text and then have to convert. What is the reason for this?
    – HealthMaps
    Aug 12, 2012 at 8:19
  • @HealthMaps Have a look at Shepherdjo's response here gis.stackexchange.com/a/29607/8227 Er... nevermind, you've obviously seen that one.
    – nagytech
    Aug 12, 2012 at 8:57
  • 1
    For the record: on Linux systems (here, Fedora), install them as this: yum install python-xlwt python-xlrd
    – markusN
    Aug 14, 2012 at 12:05
  • also just for the record. On windows with qgis 1.8 standalone installer: just extract the two archives *.gz (from pypi.python.org/pypi/xlwt and pypi.python.org/pypi/xlrd) and copy the folders xlrd and xlwt into your qgis at c:\program files(x86)\quantumGIS Lisboa\apps\Python27\Lib and install afterwards xytools ...
    – Kurt
    Sep 16, 2012 at 17:53
3

XY Tools requires extra Python modules to be installed before some of its features will work. The xlw and xlrd modules can be installed via normal Python package/module methods, which will generally install in your system's site-packages for Python.

Using pip is probably your best bet. First install pip, then install the noted packages. Relaunch QGIS to test for proper loading of plugin. QGIS will find installed modules from normal Python system paths.

1
  • 1
    Great! But I found out now that python-xlw have changed to pyton-xlwt /Cheers
    – user10236
    Sep 15, 2012 at 14:47
2

According to http://www.python-excel.org/ what used to be xlw is now xlwt

That makes the appropriate pip commands:

  sudo pip install 'xlwt'
  sudo pip install 'xlrd'
1
  • this is the best answer but should probably note that running pip install as sudo is not good security practice, as you are granting root rights to arbitrary package install scripts. better to give your active user account write permission to whatever folders pip needs to right to (e.g. chown) and then run pip as a normal user (askubuntu.com/questions/802544/…)
    – Owen
    Dec 1, 2016 at 15:08
0

FYI: There is also FreeXL which might be integrated into QGIS.

FreeXL is an open source library to extract valid data from within an Excel (.xls) spreadsheet. https://www.gaia-gis.it/fossil/freexl/index

1
  • The routine in XYtools is set up for making a point layer from an Excel file that has X & Y coordinates, like locations of disease cases with various attributes. If one has no X & Y coordinates then it will make one up for you (one X and one Y) so that you get a point vector file. It looks like FreeXL is/can be integrated into Spatialite which (i guess) means one could read in a Excel file that is not intended for a point file as an attribute file for use later. Don't know much about Spatialite.
    – HealthMaps
    Aug 13, 2012 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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