# Evaluate integrals on imported data and export the results

I have imported an excel file Data=Import["data.xlsx"] which gives the output like this:

{{{"Q", "R0", "m"}, {3, 1, 3.83171}, {4, 1.05, 7.01559}, {7, 1.1,10.1735}, {10, 1.15,13.3237}}}


I wish to evaluate the integrals u and w for each Q, R0 and m, and export the obtained results:

u[R0_, m_]:= Integrate[BesselJ[0, (m/R0)*R]*(Cosh[4*z]/Cosh[2] - Cos[4*z]/Cos[2]), {z, -(1/2), 1/2},{R, 0, R0}]
w[Q_, R0_, m_]:= Q*u[R0, m]


What I have done so far is to evaluate them one-by-one. How can I do this more efficiently? Any help would be really appreciated.

Clear["Global*"]
data = First@{{{"Q", "R0", "m"}, {3, 1, 3.83171}, {4, 1.05,
7.01559}, {7, 1.1, 10.1735}, {10, 1.15, 13.3237}}}
u[R0_, m_] :=
Integrate[
BesselJ[0, (m/R0)*R]*(Cosh[4*z]/Cosh[2] -
Cos[4*z]/Cos[2]), {z, -(1/2), 1/2}, {R, 0, R0}]
w[Q_, R0_, m_] := Q*u[R0, m]

out = Prepend[{#1, #2, #3, u[#2, #3], w[#1, #2, #3]} & @@@ (Rest@data)
, (data[[1]]~Join~{w, u})
]

Export["C:/results.out", out, "List"]


Or to an Excel file as:

Export["C:/table.xlsx", out, "XLSX"]
`
• Thank you so much, this is exactly what I wanted ! Commented Jun 15, 2023 at 10:02