Link to home
Start Free TrialLog in
Avatar of bman9111
bman9111

asked on

import certain excel cells to sql

What is the best way to take data from certain cells and insert into certain field in a sql table.

Right now my plan is to open the excel sheet grab the certain cells and link them to variables then at the end of grabbing all my data then call a insert command to the sql table.

Anyone else have a better idea?
Always looking for new approaches.

Remember the excel sheet is not formatted in a way that is a normal reading position. So I would have to pick the certain cells desired
ASKER CERTIFIED SOLUTION
Avatar of rameedev
rameedev
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bman9111
bman9111

ASKER

would that work being that data is everywhere.
meaning I have some data in A4 then data in g11

this is basically a form layout where the user types in the data depending on the label.

Like a heath insurance form, etc.

i am not sure about that..bcoz the sql query will pick values from the range that is specified in the select query...just one question

this is just one question. the code you are referring too just picks up a range. It doesn't allow you to pick A3, then A6.

There are no columns that you could search by unless you were able to do something like.

Select A2, B3, C24 from [Sheet1$A1:B30]"

and I cannot get that too work. I can get it to work if the excel sheet looks like this with row headings..

A                   B              C
Field1            field2        field3
dog               jim            great
cat                ted            bad


but my data does not look like this

So I am having to open the excel sheet and pull the values for each individual cell and then use what i pulled into an insert command...

Well in that case then i guess you need to write one single query to retreive each of the cell's value..i personally tried it out and it works
but there's one problem it's problematic to retreive the last value.

For Ex:

to retreive dog under A your select query will be

Select * from [Sheet1$A1:A2]...i tried it out it works fine

*** There is one real problem..it's difficult to retreive the very first and the Last value (i mean i was not able to retrive Field1 and cat under A)****
ok thanks for your help...I looked into it more and that solution would not work for me unless my data looked like this:
A                   B              C
Field1            field2        field3
dog               jim            great
cat                ted            bad

and it doesn't I have no column headings, my data is just scatter everywhere.

I am going to award the pts because it does work for what I listed which is:

A                   B              C
Field1            field2        field3
dog               jim            great
cat                ted            bad

thanks for your help