Created
June 8, 2012 03:49
-
-
Save swuecho/2893455 to your computer and use it in GitHub Desktop.
convert all the xsl files to csv files in one directory
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
;;;convert all the xsl files to csv files in one directory | |
;get all the file names in one directory | |
(def directory (clojure.java.io/file "C:/Users/echo/Dropbox/7000/data-sets")) | |
(def files (file-seq directory)) | |
(def filestr (map str files)) | |
;find all the xls files in the directory | |
(def xlsfiles (filter #(re-find #".xls" %) filestr)) | |
;clojure.string/replace | |
(defn xsl2csv [x] (save (read-xls x) (clojure.string/replace x #"xls" "csv"))) | |
;convert all the xls file to csv files | |
(map xsl2csv xlsfiles) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment