Hi "gene"

On Thu, Apr 28, 2011 at 8:38 PM, gene <[email protected]> wrote:
> Hello, I'm trying to directly import Excel files with the Python module xlrd
> in the console:
>
>    >>> from PyQt4.QtCore import *
>    >>> import xlrd
>    >>> wb = xlrd.open_workbook('testxy.xls')
>    >>> sh = wb.sheet_by_index(0)
>    >>> for rownum in range(sh.nrows):
>    ...            print sh.row_values(rownum)
>    ...
>    [u'id', u'x', u'y', u'test']
>    [1.0, 235.0, 424.0, u'a']
>    [2.0, 245.0, 444.0, u'b']
>    ....
>  It gives the xy values and the attributes
> So, I use the script "create layer" from
> http://www.qgis.org/wiki/Python_Bindings
> http://www.qgis.org/wiki/Python_Bindings   with no problem  for adding the
> layer and the points to the canvas except for the attribute table that
> remains empty
>
> The question is how to create a valid layer in the console?

Please post a relevant part of your script that creates a layer and
adds the data. Knowing your QGIS version would be helpful, too.

Martin
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to