Join date: May 15, 2022


Acereader Pro Deluxe Plus 8.2.0 necdafi




References External links Category:Computing-related lists Category:Computing-related softwareQ: How do you convert.Xlsx to.csv in Python? I have been trying to convert a excel file which has 2 sheets to a CSV, but no matter what I try, it gives me an error. I'm using the xlrd module and the only way that worked for me was in jupyter notebook. It was like: import xlrd import csv wb = xlrd.open_workbook('C:\test.xlsx') ws = wb.sheet_by_name('Sheet1') with open('C:\test_xls.csv', 'wb') as f: wr = csv.writer(f) wr.writerows(ws.row_values) I want to do this in python but I have no idea how. A: This answer shows how you can do this using the openpyxl module, which is a wrapper around the xlrd module. It supports CSV, so you can easily save the output as a CSV file. >>> import openpyxl >>> wb = openpyxl.load_workbook('workbook.xlsx') >>> sheet = wb['sheet'] >>> for i in range(1,4): ... sheet[i] = [cell.value for cell in sheet[i]] ... >>>"output.csv") >>> print "Wrote the file to %s" % ("output.csv") Wrote the file to output.csv >>> . L e t n ( s ) = s + 1 . L e t c ( u ) = - u - 2 . L e t q = - 4 - 0 . L e t y b e q