View Full Version : Importing from Excel


DarrenW
06-28-2004, 09:23 AM
Hi All,

**** NEWBIE ALERT****

I've working in IT for the last 9 years but so far have managed to completely avoid database design and programming! Please forgive me if I'm being really stupid, and you might have to explain things in a really simple way!!! :)

OK - I have a massive excel spreadsheet that I want to import into Access and use as a proper database. I can import it fine, however it ends up look exactly like the Excel sheet - which isn't a good database structure!

I excel I have

Cust No. Address 1 Address 2 Telephone Installed Kit
1 123 ABC St Anytown 0123456789 PC A
PC B
PC C
2 456 DEF Rd Othertown 098765432 PC D
PC E
PC F
etc etc

After importing into Access each row of the spreadsheet is a seperate datafield in the database, ie PC B and PC C do not relate to cust 1 but are seperate entries.

I would presume that the best way to structure the database would be to have two tables, one for customer details and another for installed hardware??

How do I import the hardware data and have it relate to the appropriate customer?

I hope that all makes sense!

Cheers
Darren

DarrenW
06-28-2004, 09:31 AM
OK - Good start the forum really stuffed up the last message! :mad:

Must remember to preview before I post! :)

It should look something like this:

Cust ID___Address1___Address2___Installed kit
__1______ABC st_____Anytown____PC A
_______________________________PC B
_______________________________PC C
__2______DEF RD____Othertown___PC D
_______________________________PC E
_______________________________PC F

Pat Hartman
06-28-2004, 01:58 PM
If what you are saying is that the cells in the spreadsheet are empty when they would duplicate the values from the previous row, you need to fix that before you import the spreadsheet. Write a macro if necessary that looks at the current row and if any cell has a value, the macro will fill in null values with data from the previous row.

Once you have all the values filled in, you can actually try using the table analyzer and let it suggust a possible structure. As you move through the wizard screens, make sure you change the table names appropriately when given the option. After the wizard is done, you'll probably want to change some column names also. The wizard generates poor names for the foreign keys. You want your foreign key names to be identical to the primary key that they reference. You also do not want to use embedded spaces or special characters in any column or table name.