TransWikia.com

How to Copy/Paste From Mathematica into Excel

Mathematica Asked on January 28, 2021

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.

5 Answers

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.

Answered by george2079 on January 28, 2021

I usually do something like:

ExportString[myTable,"TSV"]//CopyToClipboard

with the table in the variable myTable.

Answered by Sjoerd C. de Vries on January 28, 2021

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.

Answered by George Wolfe on January 28, 2021

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...

Answered by polfosol on January 28, 2021

For those that want to avoid mouse clicks at the expense of possibly more keypresses, postfixing //TableForm//TextCell//CopyToClipboard can be a quick fix as well:

 {{1, 2}, {3, 4}, {5,6}} //TableForm//TextCell//CopyToClipboard

This avoids the need of selecting the output, right-clicking, and choosing "Copy As" > "Plain Text".

Answered by YenForYang on January 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP