Cut and paste data from a spreadsheet

Here is a manual method using copy-and-paste that is suitable for small volumes of data on an ad hoc basis...

1) Enter the following expression into a notebook, but don't evaluate it:

data = ImportString["", "TSV"]

2) Copy the cells from the source spreadsheet onto the clipboard.

3) Paste the contents of the clipboard between the empty pair of quotes in the expression from 1). If Mathematica brings up a dialog asking whether you want "escapes inserted", select Yes. The result should look something like this:

data = ImportString["1.0\t2.0\t3.0
0.4\t0.5\t0.6
7.0\t8.0\t9.0
","TSV"]

4) Press SHIFT-ENTER to evaluate the expression.

5) data now contains the pasted cell data, interpreted as Tab-Separated Values (TSV).

Alternate Approach

Follows steps 1) through 3) as before, then...

4a) Triple-click on ImportString in the expression from 1).

5a) Press CTRL-SHIFT-ENTER to evaluate the highlighted expression in place.

6a) The notebook now contains an expression that looks like this:

data = {{1., 2., 3.}, {0.4, 0.5, 0.6}, {7., 8., 9.}}

... but that expression has not been evaluated yet.


This imports a whole sheet:

Grid[#, Dividers -> All] &@
 Import["http://joliclic.free.fr/html/object-tag/en/data/test.sxc", {"Data", 1}]

Mathematica graphics

And this imports three contiguous rows and two non-contiguous columns:

Grid[#, Dividers -> All] &@
 Import["http://joliclic.free.fr/html/object-tag/en/data/test.sxc", 
        {"Data", 1, Range[1, 3], {1, 3}}
 ]

Mathematica graphics

Details can be found on the SXC Import doc page (the range selections themselves are actually not documented there).


Copying my answer from SuperUser:

I am not familiar with the Excel clipboard format, but there is a lovely suite of tools for pasting tabular data in the form of a Palette. See this page for the code. When you evaluate that block of code, you will get a Palette with three buttons for different formats. I think there is a good probability that one of the three will do what you want.

You can save the Palette to your user Mathematica\SystemFiles\FrontEnd\Palettes directory and it will appear in the Palettes menu.


How to paste from Excel in practice

An important thing to know about the Windows clipboard is that it can hold data in several formats simultaneously. When you copy from Excel, the data gets copies in several formats, so it can be pasted into many different applications. Unfortunately, when you paste into Mathematica, the wrong format gets automatically chosen. It is not possible to remedy this from Mathematica directly.

The workaround is to first paste into Notepad, select all the text again (CTRL-A), the re-copy it as plain text format only. Now you can paste it into Mathematica using the palette's TSV or Table buttons.