473,405 Members | 2,444 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,405 software developers and data experts.

Parsing Excel Spreadsheet

Hello Everyone and thanks for your help in advance. I am
working on an application that requires the parsing of an
Excel spreadsheet that will be loaded into a SQL Server
table. An example of the spreadsheet is located at:

http://ratesheets.sollen.com/script/...ts/interfirst/
ratesheets/IFRS1_20030722_094227.xls

At the heart of the problem is the sometimes varying
layout of the spreadsheet. For example, the application
requires that the date between cells H13 and D23 be
loaded into the table. However, the same data may be
located between H12 and D22 tomorrow. So the application
needs to be able to determine the starting point of the
data. Fortunately, the headings do not change, so one of
the obvious ways to handle this is to move through each
cell (i.e. A1, A2, B1, B2) until the known header value
is achieved. However, this seems to be a very
inefficient way to handle this. Is there another way to
identify the starting point to begin processing, i.e. in
English "Find the cell that equals 30 YEAR FIXED -
Program 100". Any ehlp would be greatly appreciated.
Thanks.
Jul 19 '05 #1
7 5996
Excel has a find function. You can use that to set the active cell to the
cell containing the desired text.

Colin

"Hugh McLaughlin" <hu**@kmcnetwork.com> wrote in message
news:05****************************@phx.gbl...
inefficient way to handle this. Is there another way to
identify the starting point to begin processing, i.e. in
English "Find the cell that equals 30 YEAR FIXED -
Program 100". Any ehlp would be greatly appreciated.
Thanks.

Jul 19 '05 #2
Hello Hugh,

I don't think there is any easy to achieve this. If you know exactly where
the data is when you automate Excel, you could input it as a parameter in
your function to get the data. If you don't know, you have to search the
data by yourself. Or is it possible for you to create a special pane in
Excel file to contain the beginning area of valid data?

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ˇ°as isˇ± with no warranties and confers no rights.
Jul 19 '05 #3
Thanks for your response Tian. The Excel file is
generated by a thrid party, so I am unclear as to how I
could automate a pane. Does Colin's Find fucntion idea
make sense. How do you access it from an Asp.Net page?
-----Original Message-----
Hello Hugh,

I don't think there is any easy to achieve this. If you know exactly where the data is when you automate Excel, you could input it as a parameter in your function to get the data. If you don't know, you have to search the data by yourself. Or is it possible for you to create a special pane in Excel file to contain the beginning area of valid data?

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ˇ°as isˇ± with no warranties and confers no rights.

.

Jul 19 '05 #4
I never use A1, A2, B1 and B2 when programming. I always use the row
and columns. If you use the Find method to find the header, then you
can find the row and the column with Cel.Row and Cel.Column. Column
would be the starting column. So the first column of your table would
be StartColumn + 0, the second column of your table would be
StartColumn + 1.

You can find a cell by ExcelApp.Workbooks(1).Sheets(1).Cells(Row,
Column)

Hope this helps.

Guillaume Hanique

On Tue, 22 Jul 2003 15:29:08 -0700, "Hugh McLaughlin"
<hu**@kmcnetwork.com> wrote:
Hello Everyone and thanks for your help in advance. I am
working on an application that requires the parsing of an
Excel spreadsheet that will be loaded into a SQL Server
table. An example of the spreadsheet is located at:

http://ratesheets.sollen.com/script/...ts/interfirst/
ratesheets/IFRS1_20030722_094227.xls

At the heart of the problem is the sometimes varying
layout of the spreadsheet. For example, the application
requires that the date between cells H13 and D23 be
loaded into the table. However, the same data may be
located between H12 and D22 tomorrow. So the application
needs to be able to determine the starting point of the
data. Fortunately, the headings do not change, so one of
the obvious ways to handle this is to move through each
cell (i.e. A1, A2, B1, B2) until the known header value
is achieved. However, this seems to be a very
inefficient way to handle this. Is there another way to
identify the starting point to begin processing, i.e. in
English "Find the cell that equals 30 YEAR FIXED -
Program 100". Any ehlp would be greatly appreciated.
Thanks.


Jul 19 '05 #5
Hugh,
Have you considered querying the Excel worksheet using ADO.NET? You
talk of headings so there's are chance your data is similar enough to
a database table i.e. rows of columns. With SQL you supply the name of
the column, not the Excel range/name. The 'English' phrase you used
sounds similar to a SQL query to me...

"Hugh McLaughlin" <hu**@kmcnetwork.com> wrote in message news:<05****************************@phx.gbl>...
Hello Everyone and thanks for your help in advance. I am
working on an application that requires the parsing of an
Excel spreadsheet that will be loaded into a SQL Server
table. An example of the spreadsheet is located at:

http://ratesheets.sollen.com/script/...ts/interfirst/
ratesheets/IFRS1_20030722_094227.xls

At the heart of the problem is the sometimes varying
layout of the spreadsheet. For example, the application
requires that the date between cells H13 and D23 be
loaded into the table. However, the same data may be
located between H12 and D22 tomorrow. So the application
needs to be able to determine the starting point of the
data. Fortunately, the headings do not change, so one of
the obvious ways to handle this is to move through each
cell (i.e. A1, A2, B1, B2) until the known header value
is achieved. However, this seems to be a very
inefficient way to handle this. Is there another way to
identify the starting point to begin processing, i.e. in
English "Find the cell that equals 30 YEAR FIXED -
Program 100". Any ehlp would be greatly appreciated.
Thanks.

Jul 19 '05 #6
Thanks for your response. Actually, that is what I am
doing. However, the problem, unless I am missing
something, is that I need to define a range of cells.
Unfortunately, the range changes occasionally, thus a
static reference won't work. At that point, I need to
locate the appropraite starting cell for the range based
on a heading value. Any ideas?

-----Original Message-----
Hugh,
Have you considered querying the Excel worksheet using ADO.NET? Youtalk of headings so there's are chance your data is similar enough toa database table i.e. rows of columns. With SQL you supply the name ofthe column, not the Excel range/name. The 'English' phrase you usedsounds similar to a SQL query to me...

"Hugh McLaughlin" <hu**@kmcnetwork.com> wrote in message

news:<05****************************@phx.gbl>...
Hello Everyone and thanks for your help in advance. I am working on an application that requires the parsing of an Excel spreadsheet that will be loaded into a SQL Server
table. An example of the spreadsheet is located at:

http://ratesheets.sollen.com/script/...ts/interfirst/ ratesheets/IFRS1_20030722_094227.xls

At the heart of the problem is the sometimes varying
layout of the spreadsheet. For example, the application requires that the date between cells H13 and D23 be
loaded into the table. However, the same data may be
located between H12 and D22 tomorrow. So the application needs to be able to determine the starting point of the
data. Fortunately, the headings do not change, so one of the obvious ways to handle this is to move through each
cell (i.e. A1, A2, B1, B2) until the known header value
is achieved. However, this seems to be a very
inefficient way to handle this. Is there another way to identify the starting point to begin processing, i.e. in English "Find the cell that equals 30 YEAR FIXED -
Program 100". Any ehlp would be greatly appreciated.
Thanks.

.

Jul 19 '05 #7
Short answer: automate Excel and use its object model to call the Find
method to find the range, then plug the range into your SQL e.g.

SELECT * FROM [InterFirst Rates$D12:H23]

With ASP.NET there are many ways of automating Excel. I have no way of
telling which is the best approach for your cicumstances. Take a look
at the following KB article for a discussion of the various
approaches:

http://support.microsoft.com/default...b;en-us;311452

"Hugh McLaughlin" <hu**@kmcnetwork.com> wrote in message news:<02****************************@phx.gbl>...
Thanks for your response. Actually, that is what I am
doing. However, the problem, unless I am missing
something, is that I need to define a range of cells.
Unfortunately, the range changes occasionally, thus a
static reference won't work. At that point, I need to
locate the appropraite starting cell for the range based
on a heading value. Any ideas?

-----Original Message-----
Hugh,
Have you considered querying the Excel worksheet using

ADO.NET? You
talk of headings so there's are chance your data is

similar enough to
a database table i.e. rows of columns. With SQL you

supply the name of
the column, not the Excel range/name. The 'English'

phrase you used
sounds similar to a SQL query to me...

"Hugh McLaughlin" <hu**@kmcnetwork.com> wrote in message

news:<05****************************@phx.gbl>...
Hello Everyone and thanks for your help in advance. I am working on an application that requires the parsing of an Excel spreadsheet that will be loaded into a SQL Server
table. An example of the spreadsheet is located at:

http://ratesheets.sollen.com/script/...ts/interfirst/ ratesheets/IFRS1_20030722_094227.xls

At the heart of the problem is the sometimes varying
layout of the spreadsheet. For example, the application requires that the date between cells H13 and D23 be
loaded into the table. However, the same data may be
located between H12 and D22 tomorrow. So the application needs to be able to determine the starting point of the
data. Fortunately, the headings do not change, so one of the obvious ways to handle this is to move through each
cell (i.e. A1, A2, B1, B2) until the known header value
is achieved. However, this seems to be a very
inefficient way to handle this. Is there another way to identify the starting point to begin processing, i.e. in English "Find the cell that equals 30 YEAR FIXED -
Program 100". Any ehlp would be greatly appreciated.
Thanks.

.

Jul 19 '05 #8

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

Similar topics

6
by: Phil Powell | last post by:
What would one best recommend to parse an existing Excel spreadsheet (was done in Excel 97 or 2000 not sure to be honest)? I am looking for the most practical way of parsing an existing...
0
by: Jeff | last post by:
I will start off by giving you a background of the process I am taking. The nature of my DTS package is that I recieve an Excel Spreadsheet, run it through the DTS Package applying validation to...
9
by: (Pete Cresswell) | last post by:
I see this coming on a develpment effort that may materialize shortly. These guys don't want to mess around with automated imports from text feeds BC in the past they've had too many problems...
0
by: Rich Wallace | last post by:
Hello all, Looking for suggestions and tips if possible. I have an application running on a file server that utilizes the FileSystemWatcher to trap when any Excel files are saved by a user. I...
15
by: Hugh McLaughlin | last post by:
Hello Everyone and thanks for your help in advance. I am working on an application that requires the parsing of an Excel spreadsheet that will be loaded into a SQL Server table. An example of...
1
by: garry.oxnard | last post by:
Can anyone help me to solve a problem which involves switching from Access to Excel (then back to Access) programatically please? I have an Excel template which, on open, also opens an Access...
0
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may...
1
by: Sport Girl | last post by:
Hi everybody , i have the task of developing in Perl a script that retrieves data from 3 tables ( bugs, profiles, products) from a MySQL database called bugs and display them in an excel sheet...
2
by: treybraid | last post by:
My Flash file is a GameCenter where team standings are kept.. I have it set up right now with the master spreadsheet programmed that is linked to a dummy sheet that is saved as a CVS doc and loaded...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.