Skip to content

Instantly share code, notes, and snippets.

@nyanshell
Created October 18, 2014 08:32
Show Gist options
  • Save nyanshell/9e29bb50d34ac532b788 to your computer and use it in GitHub Desktop.
Save nyanshell/9e29bb50d34ac532b788 to your computer and use it in GitHub Desktop.
Convert xlsx to csv in a directory
#!/bin/python3
# -*- coding: utf-8 -*-
"""
xlsx2csv may have some issues while converting datetime
"""
import xlsx2csv
from glob import glob
def convert(prefix):
for _ in glob("%s*.xlsx" % prefix):
converter = xlsx2csv.Xlsx2csv(_)
converter.convert(_.rsplit(".", 1)[0]+".csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment