How to paste table from MS Excel to Wolfram Mathematica?

5,208

Solution 1

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.

Solution 2

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.

Share:
5,208

Related videos on Youtube

Dims
Author by

Dims

Software developer & Machine Learning engineer C/C++/Java/C#/Python/Mathematica/MATLAB/Kotlin/R/PHP/JavaScript/SQL/HTML/ LinkedIn: http://www.linkedin.com/in/dimskraft Telegram: https://t.me/dims12 I prefer fishing rod over fish.

Updated on September 18, 2022

Comments

  • Dims
    Dims almost 2 years

    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?

    • Bhavya Singh
      Bhavya Singh over 12 years
      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.
  • Mr.Wizard
    Mr.Wizard over 12 years
    @Szabolcs, thanks for the edit. This should have been your answer and your reputation points.
  • Bhavya Singh
    Bhavya Singh over 12 years
    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.
  • Mr.Wizard
    Mr.Wizard over 12 years
    @Szabolcs okay, I'll try to pick up some of the slack while you're away. I hope it is for something pleasant.