Created
March 23, 2023 08:09
-
-
Save xyb/1d7c6cf449039332b4c4ceb787d33ef4 to your computer and use it in GitHub Desktop.
convert excel to csv
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 openpyxl | |
import csv | |
import sys | |
input = sys.argv[1] | |
output = sys.argv[2] | |
print(f'{input} ==> {output}') | |
wb = load_workbook(input) | |
sh = wb.active | |
with open(output, 'w') as f: | |
c = csv.writer(f) | |
for r in sh.rows: | |
c.writerow([cell.value for cell in r]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment