Skip to content

Instantly share code, notes, and snippets.

@kuninet
Created October 12, 2017 13:00
Show Gist options
  • Save kuninet/fe45ffaedbf8a5a5dc514939d177448b to your computer and use it in GitHub Desktop.
Save kuninet/fe45ffaedbf8a5a5dc514939d177448b to your computer and use it in GitHub Desktop.
CSVをExcel形式で保存する
import csv
import sys
import os
import openpyxl
import importlib
argvs = sys.argv
argc = len(argvs)
wb = openpyxl.Workbook()
ws = wb.active
f = open(argvs[1])
reader = csv.reader(f, delimiter=',')
for row in reader:
ws.append(row)
f.close()
name, ext = os.path.splitext(argvs[1])
wb.save(name + '.xlsx')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment