 <p>You're sending something called "books.xls", and correctly signalling that it's an Excel spreadsheet... but it isn't. You've completely missed the step of actually creating an Excel spreadsheet containing your data (which is probably 80% of the work here).</p> <p>Try searching the web for how to create an excel spreadsheet in Python.</p>