Results 1 to 2 of 2
  1. #1
    christing is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    10

    Need Help get error message on using excel

    I am using c# to write my code but i get error message on below code.did i missing insert anything. the purpose i create this project is want excel file can convert to txt file using c# code
    using Excel;



    // Reading Excel file format; *.xlsx

    FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read);
    IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
    result = excelReader.AsDataSet();
    excelReader.Close();

    // Reading Excel file ('97-2003 format; *.xls)

    FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read);
    IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
    result = excelReader.AsDataSet();
    excelReader.Close();

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    instead of streaming the text file, use excel import

    xl.ActiveSheet.querytables.add(connection:='TEXT;. ....

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 03-17-2016, 05:53 PM
  2. "DLL Error" message trying to import from Excel
    By buddyboy in forum Import/Export Data
    Replies: 4
    Last Post: 03-19-2015, 06:26 PM
  3. Replies: 3
    Last Post: 01-13-2015, 05:21 PM
  4. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  5. Replies: 6
    Last Post: 06-27-2013, 12:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums