2016-11-30 3 views
0

私はexcelテーブル/ csvの各行から別々のテキストファイルを出力できるソフトウェアを探しています。 dokuwiki用の複数のテキストファイルを作成したい。 csvからのデータは、書式設定済みのテキストファイルテンプレートを入力します。csv/excelデータを使ってテキストフォーマットを自動化

私はこれを行うことができるpythonスクリプトを書くことができると確信していますが、このタスクをより速く、より簡単に、より簡単にするソフトウェアがあるかどうかは疑問でした。

答えて

0

これはあなたが探しているものですか?

Sub aru() 
Dim row As Long 
Dim lastrow As Long 
Dim i As Long 
Dim file As Worksheet 
Dim col As Long 
Dim lastcol As Long 
Dim dir As String 
Application.DisplayAlerts = False 
dir = "C:\txt\" 'Set here the folder you want to save the files 
i = 1 
lastrow = Cells(Rows.count, 1).End(xlUp).row 
For row = 1 To lastrow 'Define here the starting row 
    lastcol = Cells(row, Columns.count).End(xlToLeft).Column 
    Sheets.Add.Name = "File" & i 
    Set file = Sheets("File" & i) 
    For col = 1 To lastcol 
     file.Cells(1, col).Value = Cells(row, col).Value 
    Next col 
    file.SaveAs dir & file.Name & ".csv", xlCSV 
    i = i + 1 
    file.Delete 
Next row 
Application.DisplayAlerts = True 
End Sub 

また、「マスター」シートを別の名前として保存します。最後に保存せずに閉じることができます。コードを実行する前に、必要な方法で保存してください。

関連する問題