BUG: to_clipboard fails to format output for Excel
State: closed

`DataFrame.to_clipboard` has been broken for pasting to excel.  Tables are copied with spaces as delimiters instead of tabs (#21104).  

This issue originated in https://github.com/pandas-dev/pandas/commit/e1d5a2738235fec22f3cfad4814e09e3e3786f8c#diff-3f25860d9237143c1952a1f93c3aae18R102
which I've partially reverted.  

By setting the delimiter to `r'\t'`, a 2 character string, obj.to_csv raised an error, but is was caught and passed silently.  I reverted the separator to `'\t'`. 

Similar issue in `read_clipboard` also fixed.


- [x] closes #21104

Labels:
name: IO Excel
description: read_excel, to_excel

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21111?src=pr&el=h1) Report
> Merging [#21111](https://codecov.io/gh/pandas-dev/pandas/pull/21111?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/0b63e81dfcd7860a8c30e0837238ff9cc7bbe88d?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/21111/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/21111?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #21111      +/-   ##
==========================================
+ Coverage    91.9%    91.9%   +<.01%     
==========================================
  Files         154      154              
  Lines       49656    49657       +1     
==========================================
+ Hits        45637    45638       +1     
  Misses       4019     4019
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.28% <100%> (ø)` | :arrow_up: |
| #single | `41.9% <100%> (-0.13%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21111?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/21111/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZHMucHk=) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21111?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21111?src=pr&el=footer). Last update [0b63e81...676a58c](https://codecov.io/gh/pandas-dev/pandas/pull/21111?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Hello @david-liu-brattle-1! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on June 29, 2018 at 09:40 Hours UTC
@david-liu-brattle-1 can you rebase / update
And the failing tests are actually clipboard tests that are failing, so should be addressed.
@jorisvandenbossche Separate pr for the clipboard tests in #21163
Ah, thanks, didn't see that! 
Only, the existing tests in this PR should still pass / be fixed for this to be merged.
@jorisvandenbossche 
#21163 should have tests for all of the issues fixed in this PR.  I think that one will be merged first? In which case adding more tests here would be redundant right?
@david-liu-brattle-1 

- can you rebase on master
- add a whatsnew 0.23.2, IIRC this is a bug fix (IO section)
- remove the setup.py that was added.

ping on green.
> #21163 should have tests for all of the issues fixed in this PR. I think that one will be merged first? In which case adding more tests here would be redundant right?

Ah, OK, the other PR is merged now, so then in this PR the `xfail`s should be removed?
@jreback 
I think we're all set except for the setup.py file.  I'm not sure what exactly is happening with that, from my end it doesn't look like there are any changes to the existing file and I don't think I created that file.
Looks like file permissions were modified on `setup.py` (the `100755 → 100644` in the diff)

Should be able to just to reset to the current setup.py to back out the change `git checkout origin/master setup.py` 
See also - https://stackoverflow.com/questions/1257592/how-do-i-remove-files-saying-old-mode-100755-new-mode-100644-from-unstaged-cha - might have some funky git settings
@chris-b1 
Thanks, that did the trick.
@WillAyd merge when satisfied
@david-liu-brattle-1 Thanks a lot!