When I am pasting a region from MS Excel, which contains multiple numbers, to Mathematica, I am getting just a long plain sequence of digits, i.e. one integer number in Mathematica.

How to have a table of some sort, i.e. separated values?

  • I updated Mr.Wizard's answer with detailed instructions on how to paste from Excel using my palette. The edit will appear as soon as it is approved. – Szabolcs Jan 10 '12 at 9:11

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. Open this page to access 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.

  • 1
    @Szabolcs, thanks for the edit. This should have been your answer and your reputation points. – Mr.Wizard Jan 11 '12 at 4:13
  • 1
    Welcome back! I don't care about reputation any more. ;-) Now I'm the one who's leaving (today), will be absent for a while. – Szabolcs Jan 11 '12 at 7:59
  • @Szabolcs okay, I'll try to pick up some of the slack while you're away. I hope it is for something pleasant. – Mr.Wizard Jan 12 '12 at 7:17

It's not possible to paste data from Excel to Mathematica without additional software like "Mathematica Link for Excel". But you could import the data in Mathematica. See f.e. XLS Import.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.