473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

read through an excel spreadsheet in visual basic .net

Hi,

I am working on a Windows application that will read through an excel
spreadsheet of unknown size and upload the information to a file on
AS/400. I have installed the PIAs needed to connect via COM, and
have gotten as far as opening the spreadsheet. My problem is
figuring out how to loop through the cells and gather the information
one row at a time since I don't have a set range of cells. I would
appreciate any input.

Thanks
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #1
4 4823
Hi Amaryllis,

What is the reason you want to use VB.net for this?

Cor
I am working on a Windows application that will read through an excel
spreadsheet of unknown size and upload the information to a file on
AS/400. I have installed the PIAs needed to connect via COM, and
have gotten as far as opening the spreadsheet. My problem is
figuring out how to loop through the cells and gather the information
one row at a time since I don't have a set range of cells. I would
appreciate any input.

Thanks

Nov 20 '05 #2
Just out of curiosity - why are you using COM? Why not use
System.Data.Oledb and pipe through Excel's driver?

--
Sriram Krishnan
Microsoft Student Ambassador
Manager - Chennai .NET Student User Group (www.cnugstudent.net)
I blog at http://www.dotnetjunkies.com/weblog/sriram
Nov 20 '05 #3
Well,

I could use OLEDB as well or ADO, but either way, I'm still not sure
how to capture the data from each row and pipe it to the 400 since I
don't have a set number of rows to assign to the range.

As far as why I am using VB, we are a small Microsoft shop and that's
the best choice we have for an automated upload process.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #4
If I understand you question right, you can read cell contents as follows but you need to make the worksheet the active sheet:

dim w as excel.Worksheet

for i= 1 to rows (however many rows you want to read
for j=1 to cols (however many cols you want to read in each row
value=w.cells(i,j)
'store your value somewhere
next j
next i
--
Dennis in Houston
"Amaryllis" wrote:
Well,

I could use OLEDB as well or ADO, but either way, I'm still not sure
how to capture the data from each row and pipe it to the 400 since I
don't have a set number of rows to assign to the range.

As far as why I am using VB, we are a small Microsoft shop and that's
the best choice we have for an automated upload process.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JW | last post by:
I am looking for sample code to learn me about using excel from a visual basic program. I want to open a file, store code in a certain cell and save this again. Who can help me Regards
13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
5
by: chris | last post by:
I'm creating an excel document dynamically from scratch using Python and the win32com module. All is well, but now I need to add a macro to the spreadsheet and run it (to enable some sorting...
1
by: Niche | last post by:
I am new to VB.net, I know how to make command buttons and text boxes on a VB form. I need help with writing the code to ope and Excel 97 spreadsheet and place a cell data (A1) into my VB.net...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
4
by: washoetech | last post by:
Hello, I am working on a project where I need to be able to grab the data from an Excel spreadsheet and create a new table in my database based on the columns in the spreadsheet. After the...
4
by: jakekeke | last post by:
Dear all, I would like to use excel and vb.net to create a report(xml) generator, however, i wouldnt find any source for making shapes(button,label) from vb.net to initial excel what i want to...
2
by: Rod | last post by:
I want to manipulate a spreadsheet from within dotnet (using VB). I cant figure out how to get started. i.e. what is the equivalent to the VBA code On Error Resume Next Set objExcel =...
27
by: geniet | last post by:
Hello all of you, I have some problem in setting cells values (or fromat or...) in my Excel spreadsheet using a VB statement like within my Module: Range("C1").Value = 20 I have this in a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.