# How to Export my results to an excel sheet

I have a nonlinear equation in single variable( $$x \tan(x)=5$$ ) and it have an infinite number of roots , I got some of them and I want to add them in a table this is my code please, tell me how to do this?

(* In[1]:= *) Reduce[x Tan[x] == 5 && 0 <= x <= 100, x]


then I used a ToRule to convert the || to

(* In[2]:= *) ToRules[Out[1]]


then I used export to export all roots to excel sheet but i got failed

Export["myfile.xls", Out[2]]


Export::noelem: {x->Root[{-5+#1 Tan[Slot[<<1>>]]&,4.0335677903399816532}]} is not a valid set of export elements for the XLS format.

(* Out[3] = \$Failed *)

• "this is my code" - where? – J. M.'s ennui May 9 '20 at 3:37
• Reduce[x Tan[x] == 5 && 0 <= x <= 100, x] – Ragab Mohamed May 9 '20 at 3:43
• n = ToRules[Out[53]] – Ragab Mohamed May 9 '20 at 3:44
• Edit your question to include this information, instead of leaving it in comments. – J. M.'s ennui May 9 '20 at 3:44
• now you can see my code – Ragab Mohamed May 9 '20 at 3:48

Actually, the conversion of Sequence into the List can be done easy:

   a=ToRules@Reduce[x Tan[x] == 5 && 0 <= x <= 100, x];
b=x /. List[a];
Export["file.xlsx", b]


The Export gives you an Excel file with the desired column of numbers

• Thank you very much , you did it – Ragab Mohamed May 9 '20 at 5:08

I think you probably want to use NSolve instead of Reduce.

roots = x /. NSolve[x Tan[x] == 5 && 0 <= x <= 100, x]
Export["outfile.xls", roots]


This will produce a column of 32 roots, which I think is what you want.

• Thank you very much , you did it – Ragab Mohamed May 9 '20 at 5:08