LINUX.ORG.RU

Кто нибудь использовал xlrd, xlwt?

 ,


0

1

У меня, от чего то, этот код не пашет:

font0 = xlwt.Font()
font0.name = 'Times New Roman'
font0.colour_index = 2
font0.bold = True

style0 = xlwt.XFStyle()
style0.font = font0

wb = xlwt.Workbook()
ws = wb.add_sheet('A Test Sheet')
	
for y, p in enumerate(allPersons):
	ws.write(0, y, p.id)
	
wb.save('example.xls')
Ошибка: «raise ValueError(„column index (%r) not an int in range(256)“ % arg) ValueError: column index (256) not an int in range(256)»

В документации ни чего об ограничении строк в 256 штук вроде нет.

Deleted

Последнее исправление: Bizun (всего исправлений: 1)

тыц

xlwt supports creation of XLS files of the kind created by Excel 97-2003 and read by Excel 97 onwards. The file format is limited to 256 columns and 65536 rows. No amount of changing 256 to some other number in the xlwt source code will change that.

You have 3 options, in increasing order of complexity:

(1) as suggested by another, write a CSV file.

(2) openpyxl ... Excel 2007+ xlsx/xlsm format

(3) win32 COM (Windows only)

arkhnchul ★★★
()
Ответ на: комментарий от ggrn

Упс, может быть! Завтра попробую.

Deleted
()
Ответ на: комментарий от Deleted

а действительно allPersons должны быть выведены по столбцам? Так-то больше смахивает на ошибку в порядке аргументов ws.write().

arkhnchul ★★★
()
Ответ на: комментарий от arkhnchul

Не, по строкам. Это я тупанул, завтра перепроверю.

Deleted
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.