Importing Spreadsheet Data

You can easily import an Excel spreadsheet into an Access database. To do so, follow these steps:

  1. Open the database into which you want to import the spreadsheet.

  2. Right-click anywhere in the Database window and choose Import from the context menu. The Import dialog box appears.

  3. Select the folder where the spreadsheet file you want to import is located.

  4. From the Files of Type drop-down list box, select Microsoft Excel.

  5. Double-click the spreadsheet you want to import.

  6. Select Show Worksheets or Show Named Ranges (Access does not display this step of the wizard if the spreadsheet contains only one worksheet) and then click Next. The Import Spreadsheet Wizard appears.

    graphics/bulb_icon.gif

    If you plan to import spreadsheet data on a regular basis, it is helpful to define in the Excel spreadsheet a named range that contains the data you want to import. You can then easily opt to import the named range in step 6 each time you execute the import process.


  7. Select First Row Contains Column Headings, if appropriate (see Figure 18.7). Notice in Figure 18.7 that the first row appears as column headings rather than data. Click Next.

    Figure 18.7. Designating whether the first row of the spreadsheet contains column headings.

    graphics/18fig07.jpg

  8. Select In a New Table, and then click Next (see Figure 18.8). This means that Access will place the data you are importing into a new table rather than into an existing table.

    Figure 18.8. The Import Spreadsheet Wizard.

    graphics/18fig08.jpg

  9. Type the field name in the Field Name text box, if necessary.

  10. Select whether you want Access to index the field.

  11. Indicate whether to import a field by selecting the Do Not Import option for that field, if desired.

  12. Click in the field list to select the next field.

  13. Repeat steps 9?12 as appropriate for each field and then click Next.

  14. If your data has a column that is appropriate for the primary key, select Choose My Own Primary Key. Otherwise, select Let Access Add Primary Key.

  15. If you opted to choose your own primary key, select from the drop-down box the field that you want Access to use as the primary key, and then click Next.

  16. Type the table name in the Import to Table text box.

  17. Click Finish.

  18. Click OK.



    Part III: Creating Your Own Database and Objects
    Part V: Advanced Topics