Visual Studio Developer Center > Using Forums Forums > Off-Topic Posts (Do Not Post Here) > Embedding Excel Spreadsheet (.xls files) and Data Tables
Ask a questionAsk a question
 

QuestionEmbedding Excel Spreadsheet (.xls files) and Data Tables

  • Monday, November 02, 2009 5:12 AMCSE560.05 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    In Visual Studio 2008, how do you access an embedded spreadsheet (.xls) file? I'm reading in two .xls files to create two data tables (OleDB), and I'd like a way to "hard code" the file into the project for internal referencing (instead of having to reference a path/directory).

    Any help would be great. Thanks in advance!
    • Moved byBessie ZhaoMSFTTuesday, November 10, 2009 8:49 AM (From:Visual Studio Tools for Office)
    •  

All Replies

  • Monday, November 02, 2009 7:20 AMincre-d Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    What do you mean you would like a way to hard code the file.

    Are these excel files static data, or are they changed over time? have you considered using sql server express rather than excel for your data store? Or perhaps some other database.
  • Tuesday, November 03, 2009 9:40 PMCSE560.05 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Here's the situation:

    This is part of a group project in which we are limited to only using C# library components (so the SQL database is out). As of right now, we have information in 2 Excel files that is read in to generate 2 Data Table objects. This is done first thing in our program.

    As of right now, the Excel files have path locations explicitly defined in our code. We're now trying embed the resources into our project (which I believe we've done successfully via drag and drop), but we can't figure out how to actually access the excel files. Essentially we'd just like the Excel files to be integrated resources making for easy program installation/migration (don't want the users/clients to be required to download the excel files separately and place them in a set location).

    Hopefully that clarifies a little bit...
  • Friday, November 06, 2009 10:52 AMBessie ZhaoMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    <<In Visual Studio 2008, how do you access an embedded spreadsheet (.xls) file? >>

    It seems that this issue is little related to VSTO technology, VSTO is a technology for extending the UI of Office 2003 and 2007 applications in the forum of Add-ins and document-level customizations. As you mentioned, it seems to be little related to VSTO technology. The forum's PLEASE READ FIRST explains what VSTO forum is for. I also recommend you post this issue to officedev newsgroup or excel.worksheet.functions newsgroup, where there are more specialists about excel, and you would probably get more help.

    Here are the links: http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.office.developer.officedev.other&lang=en&cr=US and http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.excel.worksheet.functions&lang=en&cr=US

    If I have misunderstood this scenario, please let me know.Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.