Created
February 1, 2012 06:07
-
-
Save taka2/1715418 to your computer and use it in GitHub Desktop.
テキストファイル(1行1件)に記述した文字列をシート名にしてExcelを作成するmadojsスクリプト
This file contains hidden or 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
| Excel.create(function(excel) { | |
| File.open(ARGV[0], "r", function(infile) { | |
| infile.each(function(line) { | |
| if(line.trim().length != 0) { | |
| // 空行じゃなかったらシート追加 | |
| excel.addSheet(line); | |
| } | |
| }); | |
| }); | |
| // デフォルトのシートを削除 | |
| excel.removeSheets(3); | |
| // Excelファイルとして保存 | |
| excel.saveAs(ARGV[0] + ".xls"); | |
| }); | |
| print("done."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment