Good day folks,

lines = IO.File.ReadAllLines(txt_Source.Text)

I have here a line of code which reads a text file and save it to an array, It works well. But I wanna ask if there is anything like this code that can be use to read a excel file? Something like this :

lines = IO.File.ReadAllLines(excel.xls)

Any response will be highly appreciated :)

5 Years
Discussion Span
Last Post by GeekPlease

I already have that code. I'm just wondering if I can read an excel file by using a single line like what I've said above.

BTW, thanks bro :)


Well, personally, I have some sort of utility class with methods which handle all my Excel needs.


You can't read an Excel file line by line with a simple reader. You can

  1. create an Excel Application object and access it that way or
  2. use ADO or OleDb objects to access the data like a database

Using the first method allows you to access the Excel data on a cell by cell basis. Using the second method allows you to access the data row by row as long as the data is in tabular form (where every row is in the same format).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.