[Qgis-user] Excel Export from QGIS attribute table

Andy Harfoot ajph at geodata.soton.ac.uk
Thu Dec 1 03:56:31 PST 2011


Hi,

The functionality that I rely on to do this operation in ArcGIS and 
MapInfo is the windows clipboard - if tab delimited data is present on 
the clipboard, then it will paste with the expected tabular format into 
Excel (and many other applications). This is far and away the quickest 
method I have found (in terms of UI actions - clicks / keypresses) for 
transferring attribute data out of a GIS and is not format or software 
specific.

QuantumGIS already has this functionality available from the attribute 
table (QGIS v1.7.1), however the clipboard data generated by QGIS also 
contains a WKT representation of the geometry along with the attribute 
columns. A useful extension to the existing functionality would be to be 
able to disable the WKT column transfer in some way which would 
significantly reduce the volume of data being transferred via the 
clipboard, and consequently speed up the process.

Whilst I would always try this method over exporting to an intermediate 
file, whether that is CSV or Excel native, I suspect that with very 
large numbers of records there may be problems with system resources, so 
the file method is probably useful in addition.

Being a Windows user with little experience of Linux though, I'm not 
sure whether this method is also applicable in that OS family.

Andy


Andreas Neumann wrote:
> Hi,
>
> It is a common requirement that users want to export a QGIS attribute 
> table to Excel/CSV/Spreadsheet. While CSV is probably easy, the other 
> two are probably more complex, but there are some good Python 
> libraries around. For my users, Excel is the most requested table 
> export format.
>
> I wonder if this could be made into the core, as I think that most 
> other user want that as well. The idea is to have an export button for 
> the table, choose the format (CSV, Excel, Openoffice) and let the user 
> select if he wants all data export, or only filtered or selected rows.
>
> I guess it would be best to use Python for that purpose, as Python has 
> some good Excel libraries:
>
> * pyExcelerator: http://sourceforge.net/projects/pyexcelerator/ (Excel 
> 97/2000/XP/2003)
> * xlrd und xlwt (reader/writer): http://www.python-excel.org (Excel 
> 2.0 to 2007)
> * openpyxl: https://bitbucket.org/ericgazoni/openpyxl/wiki/Home (Excel 
> 2007 and higher)
>
> Do any of you have experience with one of the above listed packages or 
> any other recommendations? How about OpenOffice writing?
>
> Goal: cross platform without the need to have MSOffice or OpenOffice 
> installed.
>
> Would this be best implemented in C++ or in Python?
>
> Who else would be interested in such functionality?
>
> Thanks,
> Andreas
>


-- 
Andy Harfoot

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

Tel:  +44 (0)23 8059 2719
Fax:  +44 (0)23 8059 2849

www.geodata.soton.ac.uk

---------------------------------------
For further information about GeoData's
Training Courses, please visit:
           www.gis-train.com
---------------------------------------




More information about the Qgis-user mailing list