Importing an Excel file into SURVEYWin®

Sometimes you have data in an Excel file that you want to use in a new project. A common example is an Excel file of names, addresses, phone numbers and other data for each name.

Setting up the exercise:

For this exercise you will need an Excel file first.

  1. In Excel build a data file that looks like the following or use the address.xls provided:
  2. case

    fname

    lname

    street

    city

    state

    zip

    gender

    1

    Jane

    Green

    1234 5th St

    Seattle

    WA

    98000

    f

    2

    John

    White

    3456 Second Pl

    Hammond

    IL

    12345

    m

    3

    Sam

    Jones

    23 Ray St

    New York

    NY

    45678

    m

    4

    Molly

    Brown

    45 Grand Ave

    New York

    NY

    12346

    f

  3. In SURVEYWin® make a project named address that contains the questions above. You can do it one page that looks like this:
  4. Note that case is an "other" question type.
  5. Gender is a multiple choice with the codes of f for female and m for male.
  6. All the rest are write-in text questions.
  7. IMPORTANT: The names of the questions (i.e. the field names) in the form must be the same as the field names in the first row of the Excel spread sheet.
  8. Exporting from Excel and Importing into SURVEYWin®:

  9. Open the Excel file address.xls and save it as text (tab delimited). It will be saved with the extension .txt.
  10. In Windows explorer (or equivalent) rename the address.txt file as address.asc. You may ignore the error file that informs you that, " If you change a filename extension, the file may become unusable."
  11. Open SURVEYWin and select Utilities | Import database | from ASCII.
  12. In the Source ASCII input file name, browse to the address.asc file and select it.
  13. In the Destination database name, browse to the address.dat file. (If you do not already have an address.dat file, create one using SURVEYWin by selecting the address project then database info | make new database. Name the new database address.dat.
  14. Make sure that Tab and First Row contains Question names are checked.
  15. If the first row of the Excel database did not contain the Question names, you can send them from the All questions (the list of the questions in the .frm file) to the Order in Ascii file using the arrows. They must be sent in the order that they are in the Ascii file.
  16. When the important is finished, you will see a box containing the number of cases that were added to the database. The new database may be analyzed as usual.