[Qgis-user] cannot add or view .xls file to QGIS

Lee Hachadoorian Lee.Hachadoorian+L at gmail.com
Wed Nov 6 08:13:10 PST 2013


David,

I'm sorry, [1] was intended as a footnote, the link was below the sig. 
Here it is: http://www.gdal.org/ogr/ogr_formats.html.

It looks like you are using a GDAL which does not have Excel support. 
(On my list of drivers, there is an additional entry for "XLS" between 
"SEGY" and "ODS", the portion of the list you include below). I'm not 
familiar enough with the standalone installer to know for certain that 
Excel support wasn't included, or why wasn't, or if it was included and 
something else is going on. But I generally recommend (and use when I 
have to work on Windows) the OSGeo4W installer. I just looked at my 
OSGeo4W version and `ogr2ogr --formats` clearly includes "XLS" in the 
list, and testing confirms QGIS is able to open an Excel file. (What I 
reported in my last missive was tested on Linux.)

So, my recommendation is uninstall the standalone and reinstall using 
OSGeo4W. Do the advanced install so that you can check when you get to 
the Select Packages screen, under the Libs branch, that freexl (the 
library that GDAL/OGR needs) is selected.

Best,
--Lee

On 11/06/2013 08:55 AM, Chrest, David wrote:
> Lee,
>
> OK, what exactly do you mean by "According to OGR Formats page [1], it
> isn't compiled by default?" Page 1 of what document? User Guide? Where
> exactly is this OGR Formats list you talk about?
>
> I went to command line and did 'ogrinfo Untitled1.xls' and got this:
> FAILURE:
> Unable to open data source 'Untitled1.xls' with the following drivers.
>
> This is followed by a long list of drivers such as:
> ->SEGY
> ->ODS
> ->XLSX
>
> I installed the QGIS Standalone Installer Version 2.0.1 (64 bit) In late
> September or early October. Does this not come with the ability to add
> .xls files? Page 50 of Anita Graser's Learning QGIS 2.0 book states how
> easy it is to just drag/drop .xls files into QGIS but my .xls file does
> not even appear in the browser and I get an error message of invalid
> data type when trying to add by Add Vector Data. So either Anita has an
> entire page in her published book that is misleading or the standalone
> installer comes without .xls support. How can this be fixed?
>
> Thanks so much,
> David
>
> -----Original Message-----
> From: Lee Hachadoorian [mailto:lee.hachadoorian at gmail.com] On Behalf Of
> Lee Hachadoorian
> Sent: Tuesday, November 05, 2013 7:40 PM
> To: Chrest, David; qgis-user at lists.osgeo.org
> Cc: richard at duif.net; Brent Wood; G. Allegri
> Subject: Re: [Qgis-user] How do I georeference an xls file opened in
> QGIS 2.0
>
> David,
>
> Is there any chance your GDAL/OGR lacks Excel support? According to OGR
> Formats page [1], it isn't compiled by default. Try `ogrinfo <your
> file>` from the command line.
>
> I can confirm that it is working for me (QGIS 2.0.1, GDAL 1.10.0, Linux
> Mint 13) via the Add Vector Layer dialog (as described by Brent) and via
>
> drag and drop from the file system, as you describe in your original
> post. (Even without Richard's excellent XYTools plugin.)
>
> Best,
> --Lee
>
> [1] http://www.gdal.org/ogr/ogr_formats.html
>
> On 11/05/2013 03:38 PM, Richard Duivenvoorde wrote:
>> On 05-11-13 20:41, Brent Wood wrote:
>>> Cheers...
>>>
>>> I don't want to create shapefiles or csv's, etc, from spreadsheets,
> I
>>> just want to plot *.xls files which contain x/y columns on the map.
>>>
>>> I sort of figured that if a GIS tool can open an xls file this would
> be
>>> pretty basic functionality... perhaps optimistically :-)
>>>
>>> The use case I'm envisaging is a live Excel spreadsheet used to store
>>> data. New rows (records) are added as appropriate. A QGIS project
>>> includes the spreadsheet as a current layer - so a QGIS user can open
>>> the spreadsheet, as well as other map layers, & save the project.
>>> Reopening the project would automatically plot all the rows in the
>>> spreadsheet on the map.
>>>
>>> The only ways I can see to achieve this functionality involve
> recreating
>>> another copy of the spreadsheet in another format before I can view
> the
>>> points on the map. Which is an annoying extra few steps every time I
>>> want to view the spreadsheet.
>>>
>>> Is this worth filing a ticket for? Perhaps add some extra
> functionality
>>> in the vector layer dialogue: if the file type opened is an xls,
> allow
>>> the user to (optionally) specify the column identifiers for the X & Y
>>> coords & the SRID to apply?
>> Hi,
>>
>> my xytools plugin does parts of your question:
>> - it can load an xls file (xlr module needed), will ask you for a crs
>> and the x and y column, and then will create features and place those
> in
>> a memory layer (!). Which you could save to ... whatever
>> But as this is a memorylayer the link to your excelfile is not
>> memorized, so loading excel file in a project file is not working.
>>
>> Second option: as OGR  can load excel files, QGIS can load them as
>> tables (just via 'add vector layer'). Maybe (!, haven't tried this)
> you
>> can use the vrt-magic from ogr for this.
>> See http://www.gdal.org/ogr/drv_vrt.html
>> This would mean that your excel file would be accompanied by this xml
>> file which defines the columns and geometrytype. And OGR (and by this
>> hopefully QGIS) will then see it as a 'virtual' geometry containing
>> file. Please try (and report back ;-) )
>>
>> Third option: instead of real excell files,
>> use csv files (combined with vrt?) See
>> http://www.gdal.org/ogr/drv_csv.html
>>
>> The Delimited Text File layer is also pretty sophisticated nowadays!
>>
>> Hope this helps.
>>
>> Regards,
>>
>> Richard Duivenvoorde
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>

-- 
Lee Hachadoorian
Assistant Professor in Geography, Dartmouth College
http://freecity.commons.gc.cuny.edu




More information about the Qgis-user mailing list