Is there a simple way to copy/paste a table of data from Mathematica into Excel? I know I can Export the data, but copy/paste would be so much more convenient for a variety of reasons.

I've tried copy/paste from InputForm, from TableForm, using Print to format the output ... but nothing works.

up vote 15 down vote accepted

surprisingly simple.. use TableForm or MatrixForm

 {{1, 2}, {3, 4}} // TableForm

Then select the data, right-click, "copy as" "plain text" and paste into an excel cell.

If you have a MatrixForm be sure to select only the data, not the brackets.

  • This works well and easy to remember, so I mark it "correct". Others should make note that Sjoerd's answer is great, too, but a bit harder to remember IMO. – GregH Apr 4 at 12:38
  • 1
    If keyboard shortcuts are your thing, you can also do Copy As Plain Text with Control-Shift-C or Command-Shift-C. – numbermaniac Apr 4 at 12:46

I usually do something like:

ExportString[myTable,"TSV"]//CopyToClipboard

with the table in the variable myTable.

  • This is so slick - love it. I ended up marking another correct as it is easier to remember. – GregH Apr 4 at 12:39
  • 2
    @GregH Glad you like it. If remembering this is an issue you could always use a user defined function with a better name instead and put it in an init.m file. The additional advantage of the method is that it also works on huge tables that you don’t want to have on your screen. – Sjoerd C. de Vries Apr 4 at 12:48

Nothing beats ExcelLink for interacting with Excel. I even figured out how to load Excel files that exceeded the Java Virtual Heap size limit using ExcelLink (Importing a large Excel file). That problem may have gone away in 11.3, but it shows kind of things you can do with it. Of course, you do have to buy ExcelLink, but I couldn't live without it.

I have to admit that Sjoerd's trick is neat.

I simply use the Export function, e.g.

Export["data.csv", Table[Table[i*j, {i,10}], {j,10}]]

and then open the temporary output file in Excel and copy its data. Not the best solution I know, but does the job...

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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