I’m using F# and Excel Interop. I’m doing something like:
workbook.Range("A1:A10").Value2 <- [| "foo"; "3"; "bar"; "6"; "8" |]
When I look at the resulting spreadsheet, it is storing the “3”, “6”, and “8” as strings instead of numbers. This means that formulas and such fail. Is there a way to make Excel convert strings to numbers where appropriate?
My current workaround is this:
workbook.Range("A1:A10").Value2 <- [| "foo" :> obj
3 :> obj
"bar" :> obj
6 :> obj
8 :> obj |]
It produces the desired effect, but it awkward. Is there a better way to do this?
give the array a type annotation, and it will auto-upcast the elements.