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
You missed to add the value for cell sheet.cell (row=1,column=x+1).value =
Try like this
from openpyxl import *
book = Workbook ()
sheet = book.active
sheet.title = "test"
for x in range (7):
sheet.cell (row=1,column=x+1).value = "Hello"
book.save ('test.xlsx')
I faced similar issue and found out that it is because of \xa1 character which is hex value of ascii 26 (SUB). Openpyxl is not allowing to write such characters (ascii code < 32). I tried xlsxwriter library without any issue it worte this character in xlsx file.
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')