Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load excel file at runtime #36

Open
matteo-mosca opened this issue Jan 27, 2017 · 4 comments
Open

Cannot load excel file at runtime #36

matteo-mosca opened this issue Jan 27, 2017 · 4 comments
Labels

Comments

@matteo-mosca
Copy link

Description

I can't find a way to load an excel file at runtime. I can only use the one specified as a constant in the type provider initialization

Repro steps

There are no steps to reproduce this problem.

Expected behavior

I expect to use the the constant file as a "template" and then be able to specify at runtime which file to parse, which will need to have the same structure of the template. Withtout this possibility the type provider is useless in real applications.

Actual behavior

I can only load and parse the file I provide as a constant string in the type provider initialization. In other type providers I have used there is a "Load" method to call with a path parameter to specify a different file.

Known workarounds

No workarounds found.

@ppalmerjm
Copy link

ppalmerjm commented Jan 27, 2017

One would expect that to work something like the Linq to Sql provider.

Or more like a .dbml file where you can specify that

  • the template looks like a file XTemplate.xlsx in the current directory
  • and the Excel file(s) to parse can be found in some other directory with the format
    ActualFile2Parse * .xlsx.

@diegobfernandez
Copy link

Have you tried invoking the type constructor with a file path?
Check the source: https://github.com/fsprojects/ExcelProvider/blob/master/src/ExcelProvider/ExcelProvider.fs#L192

type MyExcel = ExcelFile<"excel.xlsx">
let excel = MyExcel "another-excel.xlsx"

@StefanBelo
Copy link

StefanBelo commented Mar 10, 2017

I have got the same problem. What you suggest:

type MyExcel = ExcelFile<"excel.xlsx">
let excel = MyExcel "another-excel.xlsx"

Does not load data from "another-excel.xlsx". Processing data ends with:

Exception thrown: 'System.OverflowException'

It seems new data are not loaded, nor iteration through data works, it is always loaded first row from template excel file ExcelFile<"excel.xlsx">, in never-ending loop. Exception ends data processing.

@ArtemyB
Copy link

ArtemyB commented Jun 22, 2017

@diegobfernandez thanks for the tip, it worked for me. It's great I've stumbled upon your comment. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants