Answer the question
In order to leave comments, you need to log in
How to fix excel file generation with a large number of columns?
import xlwt
workbook = xlwt.Workbook()
sheet = workbook.add_sheet("list1")
y = 0
for num in range(5000):
txt = 'привет' + str(num)
sheet.write(y, 0, txt)
sheet.write(y, 1, txt)
y = y + 1
workbook.save(file.xls)
for num in range(5):
Answer the question
In order to leave comments, you need to log in
I'll put in my five cents.
Of course, a native lib for Excel is good, but there is also numpy + pandas:
import numpy as np
import pandas as pd
random_df = pd.DataFrame(np.random.uniform(0,1,size=(5000,5000))) #создаем df 5к x 5к
random_df.to_excel('4k.xlsx') #записать данные в файл.
xlwt is an xls format that has a column limit of 256. Try the xlsx format - it has 16 thousand columns of
the library:
github.com/leegao/pyXLSX
github.com/staale/python-xlsx
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question