Read and Write Excel files in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Read and Write Excel files in Python

I am trying to read an Excel file and to write one. However, in the first case the file can't be found (and if I add the location, it considers it as corrupted). df=pd.read_excel (filename, sheetname="Sheet1") Error: XLRDERROR: Unsupported format, or corrupt file: Expected BOF record; found b'<?xml ve' When I try to write one, the file ends up existing nowhere. workbook = xlsxwriter.Workbook('pythontest.xlsx') worksheet= workbook.add_worksheet() Any clue?

17th Mar 2019, 2:38 PM
Dark Twin
Dark Twin - avatar
3 Answers
+ 2
Check your file first, it might not be a xls or xlsx file. Refer below for more help: https://stackoverflow.com/questions/9623029/JUMP_LINK__&&__python__&&__JUMP_LINK-xlrd-unsupported-format-or-corrupt-file
20th Mar 2019, 11:11 AM
Bishu Giri
Bishu Giri - avatar
0
I think u doing mistake in entering location of file
17th Mar 2019, 2:40 PM
Vintager
Vintager - avatar
0
When I write: open(filename) It opens...
17th Mar 2019, 2:43 PM
Dark Twin
Dark Twin - avatar