• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

Read/write Excel spreadsheet from ASP.net/VB.net

Hi
I need to read data from a database, populate an Excel spreadsheet and get it to do some fancy calculations, and display the results on a webpage (matching Excel cells to HTML textboxes), preferably using ASP.net and VB.net without 3rd party software. How can this be done.
Please provide an example of how to do this.

Thanks
0
rwallacej
Asked:
rwallacej
  • 3
  • 2
1 Solution
 
razoCommented:
  Dim oExcel As Excel.Application
        Dim oWorkBook As Excel.Workbook
        Dim oWorkSheet As Excel.Worksheet
        oExcel = New Excel.Application
        oWorkBook = oExcel.Workbooks.Open(Server.MapPath("") & "\MBA 200510.xls")
        oWorkSheet = oWorkBook.Worksheets().Item(1)
        oWorkSheet.Activate()
   Dim o As Excel.Range = oWorkSheet.Cells.Item(i, j)

o.value2 corresponds to the value of the cell u can get or set this property
0
 
rwallacejAuthor Commented:
Do I need import statements - I get "not defined" for all the lines "Excel."
0
 
razoCommented:
ya u have to add a reference
right click reference choose "add reference" go to the com tab and choose "Microsoft 11.0 object library"
0
 
rwallacejAuthor Commented:
thanks. I've tried this on a PC with Excel and it works but doesn't on a PC without Excel.

The problem now is that client doesn't want to install Excel on their server. Can I read/write from an excel file (and have it update the calculated cells) WITHOUT excel installed?  
0
 
razoCommented:
i dont think so...how can u work with excel functionality and have no excel!!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now