Import datasets


You can create a new dataset source in NVivo, by importing data from:

What do you want to do?


 


Gather your data

You cannot add additional records (rows) or fields (columns) to a dataset after import, so it is important to gather your data before you start the import operation.

For each dataset that you want to create, your data must be gathered into one of the following:

You cannot select multiple worksheets, text files or database tables when you import data to create a new dataset.

The maximum amount of data that can be imported into a single dataset is 256 fields (columns) and 1,048,576 records (rows).  

NOTE Text files must be organized as a tab or comma-delimited field values, so that the Dataset Import Wizard can divide the contents into records (rows) and fields (columns).  Each record must be on a separate line, and each field must be separated by the delimiter. The following is an example of a comma-delimited text file:

cn_dataset_example.gif

ic_top_of_page.gifTop of Page

Consider how you want to use your data in NVivo

You cannot change the analysis type (codable or classifying) of a field (column) after import, so you should decide how you want to use your data before you create a new dataset.

Fields that contain data that you intend to code and analyze should be stored as codable fields—for example, responses to open-ended survey questions, such as How do you think we can reduce our carbon emissions?

Fields that describe your data (metadata) should be stored as classifying fields—for example, the ID number, Age, Sex and Annual Income of your survey respondents. Values in classifying fields:

When you choose to store a field as a classifying field, you may be able to choose from several possible data types—for example, date or text. You cannot change the data type of a classifying field after import, so it is important to choose a data type that supports sorting, filtering and grouping the field values. For example, if the field contains dates, and you want to filter by date ranges, you should store the values as a date (not as text).

If you want to create nodes that represent the subjects (cases) in your research—you will need a unique identifier for each subject in your data. If your data does not contain a unique identifier that you can use as a node name, you could add a unique ID number for each subject.  This identifier should be imported as a classifying field.

ic_top_of_page.gifTop of Page

Prepare a text file or Excel spreadsheet for import

  1. Open the file that contains your data in a text editor or Microsoft Excel:

  1. If you are importing data from Excel, ensure that the data is gathered into a single worksheet.

  2. For both text files and Excel spreadsheets, review your data as described below:

Element Description
Blank rows Remove any blank rows within the data.
Extraneous content Your file should contain only the rows you want to import, and (optionally) a 1st row containing field labels. Any other content should be removed.
Data types Make sure every value in a field contains the same type of data. During the import operation, NVivo scans the first 25 rows of your file to determine what data types are appropriate for each field. If you choose to import a field using the date, time, date/time, boolean, integer or decimal data types, all the rows in your text file must contain valid data for that data type.
If a row after the 25th line, contains invalid data, the import operation will terminate with errors.
For more information about the values that can be store in a particular data type, refer to Valid data types.
  1. If you are importing a text file, review your data as described below:

Element Description
Records Each record must be on a separate line. Remove any blank lines at the beginning or end of the file.
Field delimiters Make sure that the file consistently uses tabs or commas to separate field values.
Text qualifiers Some delimited text files contain field values enclosed in single or double quotation marks, for example:
  • "John Smith",05/10/2009,"New York"
  • "Sally Watson",07/03/2010,"Dallas"

The single or double quotation mark that encloses the field value is a text qualifier.

Field values must be enclosed within text qualifiers when the field delimiter (comma or tab) appears within field values. For example, if comma is the field delimiter, and Dallas, Texas is a valid field value, you must enclose the value within qualifier, like this: "Dallas, Texas"

During the import operation, you can specify whether the file uses a text qualifier, and whether the qualifier is the single or double quotation mark.

  1. If you are importing data in an Excel Spreadsheet, review your data as described below:

Element Description
Merged cells Merged cells can cause errors during the import operation. We recommend that you do not import spreadsheets containing merged cells.
Calculated values If a cell displays a calculated value, the displayed value (not the formula) is imported into the dataset.
Error values If any of the cells in your worksheet display error values such as #NUM or #DIV, you should correct them before you start the import operation. Columns containing error values can only be imported as text fields—refer to Valid data types for more information.
Buttons and checkboxes If any cells contain controls such as buttons or checkboxes the spreadsheet cannot be imported. You should remove these controls before import.
  1. Close the text file or spreadsheet. Keeping the file open may cause errors during the import operation.

 ic_top_of_page.gifTop of Page

Prepare to import a database table or view

  1. Ensure that the data you want to import is gathered into a single table or view—you may need assistance from your database administrator to do this.

  2. Review your data as described below:

Element Description
Data types The following OLE DB data types are supported:
  BigInt DBTime LongVarWChar UnsignedSmallInt
Binary DBTimeStamp Numeric

UnsignedTinyInt

Boolean

Decimal Single VarChar

BSTR

Double SmallInt VarNumeric

Char

Guid

TinyInt VarWChar
Date Integer UnsignedBigInt WChar

DBDate

LongVarChar

UnsignedInt  

Binary objects

Databases can store 'binary objects' such as images, documents, audio or video files. If you import fields containing binary objects, any image, document or media files in supported formats (except plain text files) will be imported into NVivo as separate sources.  The dataset contains 'source shortcuts'—you can access the source by clicking on the shortcut. Refer to About datasets for more information.
If you intend to import a large number of audio or video files, you should consider where you want to store your media files—refer to Store audio and video files for more information.

ic_top_of_page.gifTop of Page

Import data and create a new dataset

NVivo provides a 'wizard' that guides you through the import process. The wizard examines the data you are importing and helps you to ensure that the data is imported the way that you want.

To create a new dataset:

  1. On the External Data tab, in the Import group, click Dataset.

rn_externaldata_import_sources.gif

The Import Dataset Wizard opens.

  1. Follow the instructions in the Import Dataset Wizard. For more information about using the wizard, refer to:

ic_top_of_page.gifTop of Page

Step 1

Click the Browse button, and then locate and select the text file or Excel spreadsheet that contains the data you want to import.

Step 2 of 5 (for Excel spreadsheets only)

Spreadsheets can contain multiple worksheets—select the worksheet that contains the data you want to import.

Check the Data Preview to make sure you have selected the right worksheet.

Step 2 of 5 (for text files only)

File Encoding Select the file encoding that is used in the text file. NVivo tries to detect the file encoding used in the file—if the Data Preview area is blank or displays strange characters, try a different file encoding.

Field Delimiter Select the character that separates the values in your text file (tab or comma).

Text Qualifier Select the character (single or double quotation marks) that encloses text values in your text file. All text enclosed within text qualifiers is imported as one value, even if the text contains a delimiter character. For example, if the delimiter is a comma (,) and the text qualifier is a double quotation mark ("), "Dallas, Texas" is imported as one field value. If no text qualifier is selected, it is imported as two separate values.

Check the Data Preview to make sure your data is being interpreted correctly.

Step 3 of 5

Under Dates, Times and Numbers, you can specify the format of any dates, times and numbers in your data. By default, NVivo expects that your data uses the dates, time and number formats specified in your Windows Regional Settings (Windows Control Panel).

First row contains column headings Select this option when the first row of your spreadsheet contains the names of your columns.

The Data Preview shows the values in the first 25 rows.

Step 4 of 5

On this screen you can choose which fields contain values that you want to code (codable fields) and which fields contain values that describe your data (classifying fields).

By default, all fields (columns) are imported, and the analysis type (codable or classifying) is preselected based on the content in the first 25 rows of the data.

Field Selection  You can use the buttons in this box to select or deselect all fields for import. For example, if you want to import only a few fields from a spreadsheet with many columns, you can deselect all fields, and then individually select the fields you want to import.

Under Field Options, you can check or change the default options for the field (column) that is currently selected in the Data Preview box at the bottom of the dialog box. The currently selected column is highlighted—you can select another column by clicking on a column header.

Field Name  This option displays the field name that will be used in the new dataset. If the first row of your data does not contain column headings, the field names are set to Column A, Column B, Column C etc. You can change these field names.

Import Field  Select this check box to import the field. If you clear this check box, the field is not imported.

Under Analysis Type, you can choose:

The Data Preview shows the values in the first 25 rows and indicates how each field will be imported. Use the scroll bars to move left and right as you review the field options selected for each column. In the example below, three of the four columns will be imported:

cn_import_dataset_analysis_type.gif

1  The background color of the columns indicate how they will be imported:

2  This is a codable field—the data type is shown in brackets (you cannot change the data type for a codable field).

3  This is a classifying field—the selected data type is shown in brackets below the column name. You can change the data type if you think another type is more suitable.

4  The dark grey background indicates that you are not importing this field.

Step 5 of 5

Enter a name and description for your new dataset.

ic_top_of_page.gifTop of Page

Dataset Import Wizard steps for databases

Step 1

In this step, you will establish a connection to your data source. This topic explains how to:

If you have difficulty establishing a connection, consult your network or database administrator.

To connect to a Microsoft Access database:

  1. Click Browse, and then select files of type ODBC. The Data Link Properties dialog box opens.

  2. On the Provider tab, select Microsoft Office 12.0 Access Database Engine OLE DB Provider, and then press Next.

  3. On the Connection tab, under Enter the data source and/or location of the data, in the Data Source box, enter the file path and file name of the Access database you want to connect to. For example, 'C:\myfiles\mydatabase.accdb'.

  4. If the Access database is password-protected, enter your User name and Password, and select the Allow saving password check box.

  5. Click Test Connection, to check that you can connect to the database.

  6. Click OK.

To connect to a SQL Server database:

  1. Click Browse, and then select files of type ODBC. The Data Link Properties dialog box opens.

  2. On the Provider tab, select Microsoft OLE DB Provider for SQL Server, and then press Next.

  3. On the Connection tab, under Select or enter a server name, enter the SQL server name and instance (e.g. 'myserver\instancename'), or click the arrow beside the box to select from the list of SQL server instances that are defined on your network.

  1. Under Enter information to log on to the server, select your authentication method. You can select:

  1. Under Select the database on the server, enter the name of the database or click the arrow beside the box to select from the list of databases on that server.

  2. Click Test Connection, to check that you can connect to the database.

  3. Click OK.

To connect any ODBC-compliant data source using a data source name (DSN):

  1. Click Browse, and then select files of type ODBC. The Data Link Properties dialog box opens.

  2. On the Provider tab, select Microsoft OLE DB Provider for ODBC drivers, and then press Next.

  3. On the Connection tab, under Use data source name, enter a data source name (DSN) that has been mapped on your computer by your network administrator, or click the arrow to select from the list of all the DSNs that are mapped on your computer.

  4. Depending on the DSN configuration, you may need to enter a user name and password. If required, under Enter information to log on to the server, enter your User name and Password, and check the Allow saving password check box.

  1. Click Test Connection, to check that you can connect to the database.

  2. Click OK.

Step 2 of 4

Select the table or view that you want to import the data from.

Step 3 of 4

On this screen you can choose which fields contain values that you want to code (codable fields) and which fields contain values that describe your data (classifying fields).

By default, all fields (columns) are imported, and the analysis type (codable or classifying) is preselected based on the content in the first 25 rows of the data.

Field Selection  You can use the buttons in this box to select or deselect all fields for import. For example, if you want to import only a few fields from a spreadsheet with many columns, you can deselect all fields, and then individually select the fields you want to import.

Under Field Options, you can check or change the default options for the field (column) that is currently selected in the Data Preview box at the bottom of the dialog box. The currently selected column is highlighted—you can select another column by clicking on a column header.

Field Name  This option displays the field name that will be used in the new dataset. If the first row of your data does not contain column headings, the field names are set to Column A, Column B, Column C etc. You can change these field names.

Import Field  Select this check box to import the field. If you clear this check box, the field is not imported.

Under Analysis Type, you can choose:

The Data Preview shows the values in the first 25 rows and indicates how each field will be imported. Use the scroll bars to move left and right as you review the field options selected for each column. In the example below, three of the four columns will be imported:

cn_import_dataset_analysis_type.gif

1  The background color of the columns indicate how they will be imported:

2  This is a codable field—the data type is shown in brackets (you cannot change the data type for a codable field).

3  This is a classifying field—the selected data type is shown in brackets below the column name. You can change the data type if you think another type is more suitable.

4  The dark grey background indicates that you are not importing this field.

Step 4 of 4

Enter a name and description for your new dataset.

ic_top_of_page.gifTop of Page