ExcelProvider
Introduction
ExcelProvider is a library for F# that is designed to make importing or processing data from Excel files easy. It provides a type provider which provides type-safe read-only access to the contents of Excel files. The provider can access data organized in rows and columns in specified sheets or ranges.
For use in a project, use the following command in the Package Manager Console:
PM> Install-Package ExcelProvider
For use in an F# script, use the following directive:
#r "nuget: ExcelProvider"
Example
This example demonstrates the use of the type provider:
// reference the type provider dll
open FSharp.Interop.Excel
// Let the type provider do it's work
type DataTypesTest = ExcelFile<"DataTypes.xlsx">
let file = new DataTypesTest()
let row = file.Data |> Seq.head
Now we have strongly typed access to the Excel rows:
row.String
val it : string = "A"
row.Float
val it : float = 1.0
row.Boolean
val it : bool = true
Documentation
For more information see the Documentation pages:
- Getting Started contains an overview of the library.
- Accessing Sheets shows how to access different sheets in a workbook.
- Accessing Rows shows how to access individual rows in a worksheet.
- Accessing Cells shows how to access individual cells within a row of a worksheet.
- Accessing Ranges shows how to access multiple ranges of data within a worksheet.
- Without Headers shows how to process sheets which do not include headers.
Contributing and copyright
The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding new public API, please also consider adding samples that can be turned into a documentation. You might also want to read library design notes to understand how it works.
The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.
namespace FSharp
--------------------
namespace Microsoft.FSharp
<summary>Typed representation of data in an Excel file.</summary> <param name='FileName'>Location of the Excel file.</param> <param name='SheetName'>Name of sheet containing data. Defaults to first sheet.</param> <param name='Range'>Specification using `A1:D3` type addresses of one or more ranges. Defaults to use whole sheet.</param> <param name='HasHeaders'>Whether the range contains the names of the columns as its first line.</param> <param name='ForceString'>Specifies forcing data to be processed as strings. Defaults to `false`.</param>