• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

Remove Headers in Excel

Hi everyone:

How to remove headers (total 11 fileds) from Excel through VB.NET code before dumping data into SQL table.

RGDS
Sam
0
BOOBIC
Asked:
BOOBIC
  • 4
  • 2
  • 2
1 Solution
 
Bob LearnedCommented:
I think this is what you mean.


In the connection string:

Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"

HDR=Yes; indicates that the first row contains columnnames, not data
IMEX=1; tells the driver to always read "intermixed" data columns as text

Bob
0
 
BOOBICAuthor Commented:
Yes, that's what you have in connection string and only one line of header. But in my case I have 11 lines of headers describing name of the file, date of creation, company name, ....I have to remove them all in order to dump data into SQL.

RGDS
Sam
0
 
Bob LearnedCommented:
How are you "dumping" to SQL?

Bob
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
BOOBICAuthor Commented:
I didn't wrote any code yet.

Sam

0
 
JigitCommented:
1. Save the Excel file as CSV ( worksheet.SaveAs() ) - comma separated text file
2. Open the CSV file programmatically for reading
3. Ignore header lines and then start dumping into SQL

HTH,
Jigit
0
 
BOOBICAuthor Commented:
Hi Jigit:

Thank you for you message. This one of the methods to use. In my app, I have to do it on Proccess_Click event (one click). I got the solution for that.

Thank you.

Sam  
0
 
JigitCommented:
BOOBIC, thank you for accepting my answer and grading it A. Would you like to fill some feedback?

Thanks,
Jigit
0
 
BOOBICAuthor Commented:
I dumped data into SQL and used Delete statement for the rows i would like to be removed.  This not that sofisticated but it does the trick. I needed to move quick with that project. And my question is opened in any way. How to do that right.

RGDS
Sam
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now