I have the following python code to write processed words into excel file. The words are about 7729
From openpyxl import *
book=Workbook ()
sheet=book.active
sheet.title="test"
for x in range (7729):
sheet.cell (row=1,column=x+1).value=x
book.save ('test.xlsx')
This is the what the code I used looks like, but when I run it, it gives me an error that says
openpyxl.utils.exceptions.IllegalCharacterError
This is my first time using this module, I would appreciate any kind of help.
Try this : This code works for me .
from openpyxl import *
book=Workbook ()
sheet=book.active
sheet.title="test"
x = 0
with open("temp.txt") as myfile :
text = myfile.readline()
while text !="":
sheet.cell (row=1,column=x+1).value=str(text).encode("ascii",errors="ignore")
x+=1
text = myfile.readline()
book.save ('test.xlsx')