Created
June 21, 2021 16:12
-
-
Save esmitt/53776a5002541a71a0cbb017b5827412 to your computer and use it in GitHub Desktop.
Convert a .csv file into a Microsoft Excel .xlsx format. It is mandatory to install the package openpyxl and pandas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import pandas as pd | |
filename = sys.argv[1] | |
filename = filename[:-4] | |
read_file = pd.read_csv (filename + ".csv") | |
read_file.to_excel (filename + ".xlsx", index = None, header=True) | |
# run as | |
# python csv_to_xlsx.py %1 | |
# where %1 is the name of the name of the file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment