M
MM
Hi to all,
I'm trying to import a tab separated values file onto Excel with the
following script:
import csv
from pyExcelerator import *
w = Workbook()
worksheet = w.add_sheet('sim1')
def writeExcelRow(worksheet, lno, columns):
style = XFStyle()
style.num_format_str = '0.00E+00'
cno = 0
for column in columns:
worksheet.write(lno, cno, column,style)
cno = cno + 1
nrow = 0
csvfile = file('res1.txt','r')
csvreader = csv.reader(csvfile, delimiter='\t')
for line in csvreader:
writeExcelRow(worksheet,nrow,line)
nrow += 1
csvfile.close()
w.save('numbers.xls')
All goes well and the resulting file "numbers.xls" has all the numbers
in the right place....
The problem is that excel sees the numbers as text and gives the error
"numbers stored as text" that I have to correct manually.
The file res1.txt has the structure of a tab separated values of
floating point numbers.
Thank you for the help.
Marco
I'm trying to import a tab separated values file onto Excel with the
following script:
import csv
from pyExcelerator import *
w = Workbook()
worksheet = w.add_sheet('sim1')
def writeExcelRow(worksheet, lno, columns):
style = XFStyle()
style.num_format_str = '0.00E+00'
cno = 0
for column in columns:
worksheet.write(lno, cno, column,style)
cno = cno + 1
nrow = 0
csvfile = file('res1.txt','r')
csvreader = csv.reader(csvfile, delimiter='\t')
for line in csvreader:
writeExcelRow(worksheet,nrow,line)
nrow += 1
csvfile.close()
w.save('numbers.xls')
All goes well and the resulting file "numbers.xls" has all the numbers
in the right place....
The problem is that excel sees the numbers as text and gives the error
"numbers stored as text" that I have to correct manually.
The file res1.txt has the structure of a tab separated values of
floating point numbers.
Thank you for the help.
Marco