i have a spread sheet that does some complex calculations and its working perfectly with Numbers on macOS,
i imported it into my project and im trying to write to a cell and it works, but when i read the expected result from another cell after calculations are done, its not changed, its the same as before, apparently the calculations are not made, what can i do ?
here is my full code
`
class ViewController: UIViewController {
let path: String = Bundle.main.path(forResource: "BCS", ofType: "xlsx")!
// Open the spreadsheet, get the first sheet, first worksheet, and first cell A1.
// This is solely demo code to show basics; your actual code would do much more here.
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
change {
let path: String = Bundle.main.path(forResource: "BCS", ofType: "xlsx")!
let spreadsheet: BRAOfficeDocumentPackage = BRAOfficeDocumentPackage.open(path)
// let sheet: BRASheet = spreadsheet.workbook.sheets[0] as! BRASheet
let worksheet: BRAWorksheet = spreadsheet.workbook.worksheets[2] as! BRAWorksheet
let cell: BRACell = worksheet.cell(forCellReference: "D20")
let cell2: BRACell = worksheet.cell(forCellReference: "E7")
print(cell.stringValue()) // prints the hard coded value instead of the expected calculated result
print(cell2.stringValue()) // prints the inserted value "8000"
}
}
func change(completion: () -> Void) {
let path: String = Bundle.main.path(forResource: "BCS", ofType: "xlsx")!
let spreadsheet: BRAOfficeDocumentPackage = BRAOfficeDocumentPackage.open(path)
let sheet: BRASheet = spreadsheet.workbook.sheets[0] as! BRASheet
let worksheet: BRAWorksheet = spreadsheet.workbook.worksheets[2] as! BRAWorksheet
worksheet.cell(forCellReference: "E7", shouldCreate: true).setStringValue("8000")
spreadsheet.save()
completion()
}
i have a spread sheet that does some complex calculations and its working perfectly with Numbers on macOS, i imported it into my project and im trying to write to a cell and it works, but when i read the expected result from another cell after calculations are done, its not changed, its the same as before, apparently the calculations are not made, what can i do ?
here is my full code ` class ViewController: UIViewController {
} `