# Table to text string [closed]

I know this is a simple question and there is a single command to do this but I have been looking for the command for 30+ minutes and cannot find it. I have a list that I want to put tabs between columns and new lines between rows. As a simple example, I have a list

  list = {{1, 2, 3}, {a, b, c}}


and I want to convert it to the string

  "1\t2\t3\na\tb\tc"

-

## closed as off-topic by Pickett, rasher, Mr.Wizard♦Jul 13 at 23:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Pickett, rasher, Mr.Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

## 3 Answers

Using ExportString:

ExportString[list, "TSV"]


If you want to make sure it's right:

ExportString[list, "TSV"] // InputForm

-

I know this is a simple question and there is a single command to do this but I have been looking for the command for 30+ minutes and cannot find it.

Let's address that. In either version 7 or version 10 searching the documentation for:

convert table to string

brings up ImportString as one of the first results; 2nd in v10, and 5th in v7.
In that documentation the first example is:

In[1]:= ImportString["3,4,6\na,b,c", "Table"]

Out[1]= {{"3,4,6"}, {"a,b,c"}}


This is quite similar to your operation but in reverse, so you should keep reading, which leads to:

This should have at least narrowed your search to the right area.

I hope this helps improve your use of the documentation system in the future.

-

Try something like this:

tb = Table["\t", {i, Length[list[[1]]]}];
Join[Transpose[{ToString /@ #1[[1]], #2}],
Transpose[{ToString /@ #1[[2]], #2}]] &[list, tb] // StringJoin

-