User Tools

Site Tools


data_load_problem_how_to_join_many_csv_files_together

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
data_load_problem_how_to_join_many_csv_files_together [2008/09/11 13:57 (16 years ago)] cliffdata_load_problem_how_to_join_many_csv_files_together [2008/09/12 09:49 (16 years ago)] (current) cliff
Line 1: Line 1:
 ====== Joining Many CSV Files Together ====== ====== Joining Many CSV Files Together ======
 +===== Warning =====
 +There is a requirement that the files be the same format. The reason is there is no matching up of invoice number to invoice number and description to description. The routine just adds one file to the end of the next. If you have headers at the start of each file you should probably remove them. The routine could be upgraded to skip the first line after the first csv file, but it doesn't do that now. As the name suggests it just joins all the files together. Good luck
 ===== Intro ===== ===== Intro =====
 When you have many files that have to be joined together so that you don't have to do a high number of loads, here is a way to accomplish that. You need to have Microsoft Excel on the machine, and you need to be able to run macros when you open the Excel Sheet. When you have many files that have to be joined together so that you don't have to do a high number of loads, here is a way to accomplish that. You need to have Microsoft Excel on the machine, and you need to be able to run macros when you open the Excel Sheet.
Line 6: Line 8:
 ==== Step 1 ==== ==== Step 1 ====
 Place the following code into a module in Excel. Place the following code into a module in Excel.
-<code|x>+<code>
 Sub Main() Sub Main()
  
Line 41: Line 43:
          
 End Sub  End Sub 
-</code|x>+</code> 
 ==== Step 2 ==== ==== Step 2 ====
 Modify a line in the code, change the path to the directory where your csv files reside. Modify a line in the code, change the path to the directory where your csv files reside.
-<code|x>+<code>
     strFolder = "M:\Docs\WindwardCustomers\GraniteCity\Inventory"     strFolder = "M:\Docs\WindwardCustomers\GraniteCity\Inventory"
-</code|x>+</code>
 ==== Step 3 ==== ==== Step 3 ====
 Modify a line in the code, change the path to the directory where your combined file will go. Do not choose the same directory as the where the csv files reside. Modify a line in the code, change the path to the directory where your combined file will go. Do not choose the same directory as the where the csv files reside.
-<code|x>+<code>
     Set objFile = fso.CreateTextFile("M:\Docs\WindwardCustomers\GraniteCity\AppendedInv.csv", ForAppending, False)     Set objFile = fso.CreateTextFile("M:\Docs\WindwardCustomers\GraniteCity\AppendedInv.csv", ForAppending, False)
-</code|x>+</code>
  
 ==== Step 4 ==== ==== Step 4 ====
 Run the macro in Excel. A message box saying "Done" will popup when the files have been combined. Run the macro in Excel. A message box saying "Done" will popup when the files have been combined.
  
data_load_problem_how_to_join_many_csv_files_together.txt · Last modified: 2008/09/12 09:49 (16 years ago) by cliff