'Export data as xlsx or xls file in python
I am trying to achieve to export data as xlsx or xls format in python. This has to be achieved without any library such as pandas openpyxl etc. Most of the articles or google searches tell me to convert it with the help of a library.
Using below code snipped, I have one csv file which is called example1.csv. In the example1.csv file, the data are structured as below:
Address Phone Status
Singapore 123 Single
China 222 Single
India 333 Single
Malaysia 444 Divorce
The end end goal is to convert the csv file to xls or xls format.
e.g : The code below is used to only read the csv file
import csv
file = open("part1.csv")
csvreader = csv.reader(file)
header = next(csvreader)
print(header)
rows = []
for row in csvreader:
rows.append(row)
print(rows)
file.close()
I do know in my previous project, I did with 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' in javascript to create the xls or xlsx format. Will it possible to use the same approach in python?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
