We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

How to strip out rows in my Excel file and leave only Detail Rows

dba123
dba123 asked
on
Medium Priority
155 Views
Last Modified: 2010-04-23
Environment:
------------------

Running this code on my PC via VS 2005
.Net version 2.0.50727 on the server (shown in IIS)
Code is in ASP.NET 2.0 and is a VB.NET Console application

Problem & Info:
---------------------

I am bringing in an Excel file.  I need to first strip out any non-detail rows such as the breaks you see with totals and what not.  I should in the end have only detail rows.   The incoming Excel file is here: http://www.webfound.net/excelfile.xls

Desired Help:
-----------------

How to perform

1)      Need to know syntax (how-to) and classes to allow me to read and stripping out all undesired rows in VB.NET for the incoming Excel File.  I've done this with a txt but never an Excel doc
2)      importing each column into sql table - just need to know how to grab each column from the excel after #1...I can do the DB portion myself
Comment
Watch Question

CERTIFIED EXPERT
Commented:
To open a Excel file on a button click..

1. U need to add Microsoft Excel 9.0 Object library reference in your project. Yes there will be problems if the client computer  has a different version of Microsoft Office. So it is better that during the time of deployment u compile the project with the same version as that present on the client computer

2. Open a excel file on button click

Dim ExcelObj as Excel.Application
Sub ExcelBtn_Click(sender As Object, e As EventArgs)
             ExcelObj = new Excel.Application()
me.openFileDialog1.FileName = "*.xls";
  if (me.openFileDialog1.ShowDialog() == DialogResult.OK)
 
  // ***********  Here is the call to Open a Workbook in Excel ****************
  // It uses most of the default values (except for the read-only which we set to true)
   Dim theWorkbook  as   Excel.Workbook
   theWorkbook = ExcelObj.Workbooks.Open(
          openFileDialog1.FileName, 0, true, 5,
          "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false,
          0, true)

         End if
      End Sub

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT

Commented:
you can use the Object to read the Actual TExt of the file
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Dog pile ;)

Bob

Author

Commented:
what is Dog Pile...formal definition please
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
U.S. slang term

http://www.answers.com/topic/dogpile

===============================================

[Usenet: prob. fr. mainstream “puppy pile”] When many people post unfriendly responses in short order to a single posting, they are sometimes said to “dogpile” or “dogpile on” the person to whom they're responding. For example, when a religious missionary posts a simplistic appeal to alt.atheism, he can expect to be dogpiled.

It has been suggested that this derives from U.S. football slang for a tackle involving three or more people; among hackers, it seems at least as likely to derive from an ‘autobiographical’ Bugs Bunny cartoon in which a gang of attacking canines actually yells “Dogpile on the rabbit!”.

===============================================

It's when everybody jumps on an easy question.

I posted in the wrong question, though.  So, that is the funniest part of all, because it doesn't make any sense here =:)

Bob
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.