Can you mail merge two excel documents

Yes, you can mail merge two Excel documents using various methods. Here are a few approaches:

Method 1: Using Excel's built-in Mail Merge feature

  1. Open both Excel files.
  2. In the first file, select the data range you want to merge.
  3. Go to the "Data" tab in the ribbon.
  4. Click on "From Other Sources" and then "From Microsoft Query".
  5. In the Query Editor, select the second Excel file as the data source.
  6. Drag the fields from the second file to the corresponding fields in the first file.
  7. Click "Finish" to merge the data.
  8. The merged data will be displayed in a new worksheet.

Method 2: Using VBA Macro

  1. Open both Excel files.

  2. Open the Visual Basic Editor (VBE) by pressing Alt+F11 or by navigating to Developer > Visual Basic.

  3. Create a new module by clicking "Insert" > "Module".

  4. Write the following code:

    Sub MailMerge()
     Dim ws1 As Worksheet
     Dim ws2 As Worksheet
     Dim lastRow As Long
     Dim lastCol As Long
    
     Set ws1 = ThisWorkbook.Worksheets("Sheet1") ' adjust to your sheet name
     Set ws2 = ThisWorkbook.Worksheets("Sheet2") ' adjust to your sheet name
    
     lastRow = ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row
     lastCol = ws1.Cells(1, ws1.Columns.Count).End(xlToLeft).Column
    
     For i = 1 To lastRow
         For j = 1 To lastCol
             ws1.Cells(i, j).Value = ws2.Cells(i, j).Value
         Next j
     Next i
    End Sub
  5. Save the module and close the VBE.

  6. Run the macro by clicking "Developer" > "Macros" and selecting the "MailMerge" macro.

  7. The data will be merged into the first worksheet.

Method 3: Using Power Query

  1. Open both Excel files.
  2. In the first file, select the data range you want to merge.
  3. Go to the "Data" tab in the ribbon.
  4. Click on "New Query" and select "From Other Sources" > "From Microsoft Query".
  5. In the Query Editor, select the second Excel file as the data source.
  6. Drag the fields from the second file to the corresponding fields in the first file.
  7. Click "Load" to merge the data.
  8. The merged data will be displayed in a new worksheet.

These methods will merge the data from both Excel files into a new worksheet. You can adjust the code or queries to suit your specific needs.