This is my first time posting here so I am sorry if I've missed some of the code of conduct you usually have.
I am having problems converting my Excel (xlsx) file to a CSV file using Python. This is required by my job, I wouldn't be otherwise doing it. So my excel file is structured like this: I have a name for our service, our buy price for it, and our customers buy price for it.
The problem that I am facing is that when lets say for example I have a line like this in my xlsx file:
BasicLevel 1798,20 1998,00
ExtremLevel 2,25 2,50
But whenever I convert my xlsx file to a csv file, the line turns into this:
BasicLevel 1516.41 1684.9
ExtremLevel 43344 43102
So now what has happened is that the numbers have indeed changed. This makes the whole program obsolete as the numbers HAVE to be correct.
This is my xlsx to CSV conversion code:
def csv_from_excel_max():
wb = xlrd.open_workbook("Pricelist.xlsx")
sh = wb.sheet_by_name("EUR")
result_file = open("result_file.csv", "wb")
wr = csv.writer(result_file, delimiter=";")
rownum = 0
while rownum < sh.nrows:
wr.writerow([str(sh.cell(rownum, 3).value.replace(u"\xa0", "").replace(u"\u2122", "")).encode("utf-8"),
sh.cell(rownum, 9).value,
sh.cell(rownum, 10).value])
rownum += 1