Using the ExcelDataReader within a F# project. To use the first row as Column names (headers) the configuration needs to be adjusted with the following C# code:
var result = reader.AsDataSet(new ExcelDataSetConfiguration() {
ConfigureDataTable = (_) => new ExcelDataTableConfiguration() {
UseHeaderRow = true
}
});
As is explained in https://github.com/ExcelDataReader/ExcelDataReader#important-note-when-upgrading-from-exceldatareader-2x
If I try to translate this to F# code:
let result = reader.AsDataSet (
new ExcelDataSetConfiguration (
ConfigureDataTable = ExcelDataTableConfiguration (
UseHeaderRow = true)
)
)
I get the following error:
error FS0001: This expression was expected to have
type 'Func<IExcelDataReader,ExcelDataTableConfiguration>' but here has
type 'ExcelDataTableConfiguration'
If I understand well, I will have to pass a Linq expression, so I looked at some examples:
http://www.fssnip.net/ts/title/F-lambda-to-C-LINQ-Expression
How do I create a Linq expression tree with an F# lambda?
Unfortunately I didn't manage to solve this problem. Any pointers will be hugely appreciated!