1

So I am running some Python scripts that print out data tab-delimited (i.e. adding the \t character during the print command).

Problem

  • I am trying to copy that tab-delimited data from the Terminal into Excel Mac, hoping Excel would recognize the tab-delimination and put the items into separate cells

This does not work; however, if I copy the text into an editor such as Atom or Emacs first, and then into Excel, it recognizes the tabs as delimiters.

  • Why does it work with the additional step?
  • Do the text editors change the nature of the tabs, and how can I emulate this behavior within the Terminal?

Example:

print "123\tbeetle\t12.4\n200\tbutterfly\t1.2\n"

Result:

Copy from Terminal into Excel:

Copy into Excel directly

Copy from Terminal to Text Editor, then into Excel:

Copy via Text Editor

Any help is much appreciated! I know there are more elegant ways of doing this, but this is still something I'd like to figure out.

I found a somewhat similar, but unresolved question here.

Running Python 2.7.13 , Sierra 10.12.6, Excel 2016 for Mac

You must log in to answer this question.

Browse other questions tagged .