B4J Question [Solved] [XLUtils] Enter a value and get the result

angel_

Well-Known Member
Licensed User
Longtime User
Is it possible to enter a value in a cell and read the data in another cell after the calculation by excel?

B4X:
Sub Resultado
    xl.Initialize
    Dim Libro As XLWorkbookWriter = xl.CreateWriterFromTemplate(File.DirAssets, "PruebaCalculo.xlsx")
    Dim sheet As XLSheetWriter
    sheet = Libro.CreateSheetWriterByIndex(0)
    For i = 1 To 5 Step 1
        Dim DireccionCelda_ColA As XLAddress = xl.AddressName("A1")
        sheet.PutNumber(DireccionCelda_ColA, i)
        Dim DireccionCelda_ColC As XLAddress = xl.AddressName("C1")
        Log(sheet.GetCell(DireccionCelda_ColC).ValueNumeric)
    Next
End Sub
 

Attachments

  • Products.zip
    6.9 KB · Views: 118

Erel

B4X founder
Staff member
Licensed User
Longtime User
Two options:
B4X:
For i = 1 To 5 Step 1
    sheet.PutNumber(xl.AddressName("A1"), i)
    Libro.EvaluateFormulas
    Dim ReaderResult As XLReaderResult = xl.Reader.SheetToResult(sheet.PoiSheet)
    Dim result As Int = ReaderResult.Get(xl.AddressName("C1"))
    Log(result)
Next

B4X:
For i = 1 To 5 Step 1
    sheet.PutNumber(xl.AddressName("A1"), i)
    Libro.EvaluateFormulas
    Dim Result As Int = sheet.GetCell(xl.AddressName("C1")).ValueCached
    Log(Result)
Next
 
Upvote 0
Top