Any of those help Sorry everyone for the year long late reply. Here's my entire function as of today.

code :

```
func createExcel(amortizationArray: [amortizationObject], loanName: String) -> Date
{
// Post notification that createExcel has started
NotificationCenter.default.post(name: .isStart, object: nil)
// Set the path to the path of wherever you put your Excel file.
let path: String = Bundle.main.path(forResource: "AmortizationTable", ofType: "xlsx")!
// Open the spreadsheet, get the first sheet, first worksheet, and first cell A1.
let spreadsheet: BRAOfficeDocumentPackage = BRAOfficeDocumentPackage.open(path)
let worksheetToCopy: BRAWorksheet = spreadsheet.workbook.worksheets[0] as! BRAWorksheet
let worksheetName = "Amortization Table"
let worksheet: BRAWorksheet = spreadsheet.workbook.createWorksheetNamed(worksheetName, byCopying: worksheetToCopy)
var cell: BRACell
for i in 0..<amortizationArray.count
{
let amortObj = amortizationArray[i]
var color: UIColor
if amortObj.shade
{
color = UIColor(rgb: 0xf9f9f9)
}
else
{
color = UIColor(rgb: 0xf2f2f2)
}
cell = worksheet.cell(forCellReference: ("A" + String(describing: (i+2))), shouldCreate: true)
cell.setCellFillWithForegroundColor(color, backgroundColor: .white, andPatternType: kBRACellFillPatternTypeDarkTrellis)
let period = amortObj.amortiaztionValuesArray[0]
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .short
dateFormatter.locale = Locale.current
if let date = Calendar.current.date(byAdding: .month, value: Int(period), to: Date()) {
let value = dateFormatter.string(from: date)
cell.setStringValue(value)
}
let cellColumns = ["B", "C", "D","E","F","G"]
for j in 0..<cellColumns.count
{
let column = cellColumns[j]
cell = worksheet.cell(forCellReference: (column + String(describing: (i+2))), shouldCreate: true)
let value = currencyInput(index: j+1, amortObj: amortObj)
cell.setStringValue(value)
cell.setCellFillWithForegroundColor(color, backgroundColor: .white, andPatternType: kBRACellFillPatternTypeDarkTrellis)
}
}
var paths: Array = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) as Array
let fullPath: String = paths[0] + "/" + loanName + ".xlsx"
spreadsheet.workbook.removeWorksheetNamed("Sheet1")
spreadsheet.save(as: fullPath)
let date = Date()
UserDefaults.standard.set(fullPath, forKey: String(describing: date))
return date
}
```

```
// Set the path to the path of wherever you put your Excel file.
let path: String = Bundle.main.path(forResource: "AmortizationTable", ofType: "xlsx")!
// Open the spreadsheet, get the first sheet, first worksheet, and first cell A1.
let spreadsheet: BRAOfficeDocumentPackage = BRAOfficeDocumentPackage.open(path)
let worksheetToCopy: BRAWorksheet = spreadsheet.workbook.worksheets[0] as! BRAWorksheet
let worksheetName = "Amortization Table"
let worksheet: BRAWorksheet = spreadsheet.workbook.createWorksheetNamed(worksheetName, byCopying: worksheetToCopy)
```

```
var paths: Array = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) as Array
let fullPath: String = paths[0] + "/" + loanName + ".xlsx"
spreadsheet.workbook.removeWorksheetNamed("Sheet1")
spreadsheet.save(as: fullPath)
```