I keep getting this error (see below) when trying to save the attribute table to an Excel file using XY Tools. Can anyone help? I have deleted and re-installed xytools but this hasn't helped.

An error has occured while executing Python code:

Traceback (most recent call last):
File "C:/Users/Doug/.qgis2/python/plugins\xytools\xytools.py", line 301, in excelSave
xlw.writeAttributeRow(rowNr, values)
File "C:/Users/Doug/.qgis2/python/plugins\xytools\providers\excel.py", line

57, in writeAttributeRow self.ws.write(rowNr, colNr, cell) File "build\bdist.win-amd64\egg\xlwt\Worksheet.py", line 1030, in write self.row(r).write(c, label, style) File "build\bdist.win-amd64\egg\xlwt\Worksheet.py", line 1078, in row self.rows[indx] = self.Row(indx, self) File "build\bdist.win-amd64\egg\xlwt\Row.py", line 42, in __init raise ValueError("row index (%r) not an int in range(65536)" % rowx) ValueError: row index (65536) not an int in range(65536)

Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

QGIS version: 2.6.1-Brighton Brighton, e2a51df

  • The "not an int range(65536)" message seems to allude the format that you are saving to may not support more than 65536 records, superuser.com/questions/366468/…
    – artwork21
    Commented Oct 29, 2015 at 12:23
  • 1
    Thanks Joseph. This is a neat plug-in. Worked perfectly!
    – Doug
    Commented Oct 29, 2015 at 12:29
  • Awesome buddy, glad you got it working! Will post the comment as an answer for the convenience of others, but also note that there are a number of methods to get what you're looking for, some of which have already been posted by others :)
    – Joseph
    Commented Oct 29, 2015 at 12:38

4 Answers 4


As my comment suggests, you need to save to a newer version of excel (v2007 or >) to save a GIS table that has more than 65536 records.


An alternative is to use the MMQGIS plugin which, when enabled, could be accessed from the Toolbar:

MMQGIS > Import / Export > Attributes Export to CSV File

Hope this helps!


ValueError("row index (%r) not an int in range(65536)" % rowx) ValueError: row index (65536) not an int in range(65536)

indicates that the number of rows is to large. *.xls has a max number of rows according to this post.

You could try to save it as *.xlsx or split the records or try it with another plugin as Joseph suggests.


There is a workaround where you can select all attributes by hitting the left uppermost in the attribute table

enter image description here

press Ctrl + C to copy all the attributes

Open excel and paste the features

Hope this will help you.

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.