Note that there are some explanatory texts on larger screens.

plurals
  1. POExcelLibrary and EPPlus throwing exceptions when opening network file
    primarykey
    data
    text
    <p>I have an excel file on a server. I access it with a path looking like this : "\\Server\folder\file.xlsx".</p> <p>I was able to read it with the Excel API from office, but since I cannot install office on my server, I need to avoid this dependency.</p> <p>I tried using some other libraries, but it does not work...</p> <p>I tried opening the file with EPPLUS, but I have an exception saying " This operation is not supported for a relative URI" when I try to open the workbook... I tried with ExcelLibrary, but I have an out of memory exception...</p> <pre><code>//EXCELLIBRARY Workbook book = Workbook.Load(_filename); //EPPLUS FileInfo file = new FileInfo(_filename); ExcelPackage pack = new ExcelPackage(file); ExcelWorksheet sheet = pack.Workbook.Worksheets[1]; </code></pre> <p>Does someone have an idea on how to solve this?</p> <p>If not, you have another library to suggest? I don't want to use OleDB and already tried NOPI. I want a library that only need to add a reference to a dll. I need to open excel 2010 files. I also need to be able to determine what is the used range in the sheet and get a array with the values. Here is the code that I used and worked with the office API.</p> <pre><code>Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.ApplicationClass(); xlWorkBook = xlApp.Workbooks.Open(_filename, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); _range = (System.Array)xlWorkSheet.UsedRange.Value2; _headers = GetHeaders(_range); _lastRow = xlWorkSheet.Cells.Find("*", misValue, misValue, misValue, Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlPrevious, false, misValue, misValue).Row; xlWorkBook.Close(false, misValue, misValue); xlApp.Quit(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload