File module issues with excel format

0 votes

This is some basic code that I use to write results into a single Excel file:

import  numpy_financial as npf
Present =2000
period =20
rate =0.12
pmt =abs(npf.pmt(rate/12,period*12,Present))
print(pmt)
import  csv
file =open("Result.xlsx",'w')
file =  csv.writer(file)
file.writerow([pmt])

as a result - Outcome. When I change the xlsx extension to csv, it opens successfully. I am aware that there is a library called xlsxwriter, but I'm curious as to whether the csv module supports xlsx extensions. Do I have something missing?

Apr 2, 2023 in Others by narikkadan
• 63,600 points
574 views

1 answer to this question.

0 votes

The xlsx extensions are not supported by the csv module. An excerpt from the documentation I linked is provided below:

The csv module implements classes to read and write tabular data in CSV format

Support for writing xlsx is not mentioned in the docs.

answered Apr 2, 2023 by Kithuzzz
• 38,000 points

Related Questions In Others

0 votes
1 answer

Add a correct format date in Excel file with Python openpyxl

Use just datetime.fromisoformat(row['Date']) but I didn't have ...READ MORE

answered Feb 9, 2023 in Others by narikkadan
• 63,600 points
2,617 views
0 votes
0 answers

Convert Rows to Columns with values in Excel using custom format

1 I having a Excel sheet with 1 ...READ MORE

Feb 17, 2022 in Others by Edureka
• 13,690 points
975 views
0 votes
1 answer

How to get the JasperReports into Excel format with proper alignment

Remove at least one parameter: exporter.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.TRUE) Note that JRXlsExportParameter is deprecated the correct ...READ MORE

answered Sep 21, 2022 in Others by narikkadan
• 63,600 points
3,834 views
0 votes
1 answer

Convert csv- or Excel-file (xlsx) to kml with custom markers

With some help from the community, I ...READ MORE

answered Sep 26, 2022 in Others by narikkadan
• 63,600 points
1,228 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP