To get started simply add ExcelProvider.dll as a reference to your project.
If you are using F# scripts then just add the dll using the
If you then open
FSharp.Interop.Excel you will have access to the Type Provider functionality.
You can then create a type for an individual workbook. The simplest option is to specify just the name of the workbook. You will then be given typed access to the data held in the first sheet. The first row of the sheet will be treated as field names and the subsequent rows will be treated as values for these fields.
When creating the type you can specify the following parameters:
FileNameLocation of the Excel file.
SheetNameName of sheet containing data. Defaults to first sheet.
A1:D3type addresses of one or more ranges. Defaults to use whole sheet.
HasHeadersWhether the range contains the names of the columns as its first line.
ForceStringSpecifies forcing data to be processed as strings. Defaults to
All but the first are optional.
The parameters can be specified by position or by using the name - for example the following are equivalent:
This example shows the use of the type provider in an F# script on a sheet containing three rows of data:
1: 2: 3: 4: 5: 6: 7: 8: 9:
And the variable
test has the following value: