# How to save the multiple output of mathematica in same excel file with out over writing

ClearAll
(*befor finding the root for a lower stiffness use NSlove to find , \
then put that value back on the Rootfind and find the beta for \
varying stiffness *)
k = 10^12;(*1*10^b;*)
a = 1/(4*b^3*(1 + Cosh[b]*Cos[b]));
a1 = (Cos[b*x] - Cosh[b*x]);
a2 = (Sin[b*x] - Sinh[b*x]);
phi1 = (Cos[b] + Cosh[b])*(Sin[b*(1 - i)] + Sinh[b*(1 - i)]);
phi2 = (Sin[b] + Sinh[b])*(Cos[b*(1 - i)] + Cosh[b*(1 - i)]);
phi3 = (Sin[b] - Sinh[b])*(Sin[b*(1 - i)] + Sinh[b*(1 - i)]);
phi4 = (Cos[b] + Cosh[b])*(Cos[b*(1 - i)] + Cosh[b*(1 - i)]);
eq = a*((phi1 - phi2)*(a1 /. x -> i) + (phi3 + phi4)*(a2 /. x -> i));
eq1 = 1 + (k*eq);
t1 = Table[eq1, {i, 0.01, 0.5, 0.01}];
TableForm[t1];

m = 5;
f[x_] := t1[[m]] /. b -> x;
p = Plot[{f[x], 0.}, {x, 0.1, 30}, PlotPoints -> 350];
intersections = GraphicsMeshFindIntersections[p] // Chop
Export["myFile.xls", intersections[[All, 1]]]
intersections = GraphicsMeshFindIntersections[p] // Chop
Labeled[Show[p, Frame -> True, Axes -> False,
Epilog -> {PointSize[.025], Red, Point[intersections]}],
Style[#, 20] &@Column[N[intersections, 10], Frame -> All], Right]


Right now I am facing a problem where I want to export the output of mathematica to excel, but each time in different column of the excel file. But all i am getting is overwritten in the same column. how to overcome this

• Most programs would find this difficult. Writing to successive rows is relatively easy (well for CSV or TSV it is; XLSX is a nasty format to work with in general). But if your data isn't massive (which it isn't if you're planning on having it in XLSX / opening it in Excel) you should be able to just build the entire thing in memory and export once. – b3m2a1 Jan 11 '18 at 8:11
• For each value of my 'm', the roots are going to change, I want to export those for every value of m – Vijay Kumar S Jan 11 '18 at 8:31
• So build a list of the roots and export that list each time you change it. If you're worried about quitting and restoring just reimport the list at the beginning of a session. – b3m2a1 Jan 11 '18 at 8:32
• I would absolutely aggree with b3m2a1 that XLS is just the wrong choice for the task at hand. I also would recommend to use some other format during computation and if desired only store the final result in XLS. If you use CSV during computation you can just open that with Excel anyway. Is there any good reason why you want XLS for the intermediate storage? – Albert Retey Jan 11 '18 at 9:38
• Alternatively, you can build up the computation in a CSV file (using PutAppend, Write or WriteString) and then finish by converting that CSV to XLSX. – Sjoerd Smit Jan 11 '18 at 11:01