Skip to content

Instantly share code, notes, and snippets.

@taka2
Created February 1, 2012 06:07
Show Gist options
  • Select an option

  • Save taka2/1715418 to your computer and use it in GitHub Desktop.

Select an option

Save taka2/1715418 to your computer and use it in GitHub Desktop.
テキストファイル(1行1件)に記述した文字列をシート名にしてExcelを作成するmadojsスクリプト
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