0

I'd like to be able to ready an excel file by column index, row by row, in VB .NET.

I can do it extremely easily with python XLRD, and with vb6 via "ADOX.Catalog"

Basically, this should be enough for my needs:

wb = open(excelfile)
ws = wb.worksheet(0)
cell = ws.get_cell(col, row)

How can I do that?

  1. Is there a way to get the columns of a worksheet?
  2. I haven't found any documentation of NPOI
  3. I haven't found any *.vb file samples in the NPOI downloads (alpha, beta and stable versions)
  4. is there a unified excel file opener that will detect the file version and pick up the correct opener class, or do i have to do it by file extension?
  5. subjective question: am I the only one who think this API is overly complex?

IMPORTANT EDIT: I CAN'T INSTALL EXCEL ON THE MACHINE, so i'm looking for non-excel solutions

ps. i'm new to .net

Berry Tsakala
  • 15,313
  • 12
  • 57
  • 80

1 Answers1

0

Not sure what npoi is, but this may help, assuming you have declared them:

xlObject = new excel.application()
xlWB = xlObject.workbooks(0) // I think it also takes string (name of wb)
sheet = xlWB.worksheet(0)
sheet.Range("B2") //specific cell

Are you talking about xls vs xlsx? It should handle both fine...

And NO! It's not nearly as intuitive or simple as it should be!

7200rpm
  • 548
  • 1
  • 4
  • 14