Importing Data Using Drag-and-Drop

Problem

You routinely use drag-and-drop to open files in Windows and are wondering if you can do the same with text files in Excel.

Solution

Yes, you can. Simply drag the text file and drop it on Excel's window.

Discussion

While this sounds trivial, you'll quickly realize that dragging and dropping a text file into a spreadsheet does not always yield the results you'd like. Take a look at the example shown in Figure 3-7.

Figure 3-7. Text imported by drag-and-drop

The data contained in the text file was indeed loaded into the spreadsheet; however, all of the data on each line in the text file was lumped into a single cell (in column A) on each row in the spreadsheet. In this form, the data is treated as text and you can't perform analyses on the data or plot it on a chart. You need to parse the data in order put it in a useful form, i.e., separate the data into columns. See Recipe 3.6 to learn how to convert text like that shown in Figure 3-7 to columns of data.

See Also

See Recipe 3.6 to learn how to convert strings of text to useful columns of data.

Also, take a look at Recipes 3.1, 3.2, 3.4, and 3.5 for alternative data-importing techniques.

Категории