Without Headers
To process a sheet which does not include headers you can use the HasHeaders
parameter.
This parameter defaults to true
.
If you set it to false
, then all rows are treated as data.
Example
This example shows the use of the type provider in an F# script on a sheet containing no headers:
// reference the type provider
open FSharp.Interop.Excel
// Let the type provider do it's work
type DataTypesTest = ExcelFile<"DataTypesNoHeader.xlsx", HasHeaders=false>
let file = new DataTypesTest()
let row = file.Data |> Seq.head
let test = row.Column2
And the variable test
has the following value:
|
Multiple items
namespace FSharp
--------------------
namespace Microsoft.FSharp
namespace FSharp
--------------------
namespace Microsoft.FSharp
namespace FSharp.Interop
namespace FSharp.Interop.Excel
type DataTypesTest = ExcelFile<...>
type ExcelFile =
inherit ExcelFileInternal
<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>
<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>
val file: DataTypesTest
val row: ExcelFile<...>.Row
property ExcelFile<...>.Data: System.Collections.Generic.IEnumerable<ExcelFile<...>.Row> with get
module Seq
from Microsoft.FSharp.Collections
val head: source: 'T seq -> 'T
val test: float
property ExcelFile<...>.Row.Column2: float with get