📊

Module 6 Video - writematrix: Exporting Numeric Data to an Excel Workbook: Part 2

Mar 7, 2025

Writing Information to Excel Workbooks

Introduction

  • Focus: Writing data to existing Excel files.
  • File Used: w1.xlsx (copy created as w1mod.xlsx for safety).
  • Contains one sheet: "random stuff".
  • Two matrices involved: xmat2 and xmat3.

Writing to a New Sheet

  • Using WriteMatrix:
    • Purpose: To create a new sheet "NewSheet1" in w1mod.xlsx.
    • Specification:
      • Matrix: XMAT2
      • File: w1mod.xlsx
      • Sheet: NewSheet1
      • Starting Cell: B2
    • Result: "NewSheet1" created with XMAT2 data starting at B2.

Writing to an Existing Sheet

  • Without Specifying a Range:

    • Default behavior: Writes to the first sheet "random stuff" starting at A1.
    • Effect: Only changes necessary cells for XMAT2.
  • Specifying a Range:

    • Example: Write to "random stuff" starting at D3.
    • Observations:
      • Data extended into a new column.
      • Unchanged cells remain unaffected.

Overwriting Data

  • Complete Overwrite:
    • Sometimes needed to replace entire data.
    • Method to be discussed in the next video.

Appending Data

  • Appending to Existing Data:
    • Objective: Add new information below existing data in a sheet.
    • Example: "NewSheet1" required new data to start at B5.
    • Specification Required:
      • Range: Start at B5.
      • Sheet: NewSheet1
      • Matrix: XMAT3
    • Result: XMAT3 appended below existing data in "NewSheet1".
    • Note: Manual specification of range is required.

Conclusion

  • Future learning: Automating the process of appending data without manual range specification to be addressed in the next video.