Is it possible to compute with the trapezoidal rule by numerical integration?

t = Table[{x, Sin[x]}, {x, 0, Pi, .01}];
1/2 Total[((#[[2, 1]] - #[[1, 1]]) (#[[2, 2]] + #[[1, 2]])) & /@  Partition[t, 2, 1]]
(*
-> 1.99998
*)

Perhaps better

1/2 Total[Differences[t[[All, 1]]] ListCorrelate[{1, 1}, t[[All, 2]]]]

They are just

$$\int_a^b f(x)\,dx\approx\frac12\sum_{k=1}^N (x_{k+1}-x_k)(f(x_{k+1})+f(x_k))$$

Edit

Just for fun, using JM's shorter expression:

Manipulate[
   Column[{
     Show[Plot[Sin[x], {x, 0, Pi}], ListLinePlot[#, Filling -> Axis],
         AspectRatio -> Automatic, ImageSize -> 400], 
     Row[{"Approx Integral = ",N@Differences[#1].MovingAverage[#2, 2]& @@ Transpose[#]}]}]&@
     Table[{x, Sin[x]}, {x, 0, Pi, Pi/a}],
 {{a, 2, Dynamic[a]}, 2, 10, 1}]

enter image description here


The following is quite fast on packed arrays:

(Rest@Last@# + Most@Last@#).(Rest@First@# - Most@First@#)/2 &@
 Transpose[t]

Small example:

t = Developer`ToPackedArray@
   Table[{x, Sin[x]}, {x, Subdivide[0., Pi, 100]}];

Differences[#1].MovingAverage[#2, 2] & @@ Transpose[t] //
 RepeatedTiming
1/2 Total[Differences[t[[All, 1]]] ListCorrelate[{1, 1}, t[[All, 2]]]] //
 RepeatedTiming
(Rest@Last@# + Most@Last@#).(Rest@First@# - Most@First@#)/2 &@ Transpose[t] //
 RepeatedTiming
(*
  {0.000036, 1.99984}
  {0.000014, 1.99984}
  {8.5*10^-6, 1.99984}
*)

Larger example (autocompiled by Table, which produces a packed array):

t = Table[{x, Sin[x]}, {x, Subdivide[0., Pi, 10000]}];

Differences[#1].MovingAverage[#2, 2] & @@ Transpose[t] //
 RepeatedTiming
1/2 Total[Differences[t[[All, 1]]] ListCorrelate[{1, 1}, t[[All, 2]]]] //
 RepeatedTiming
(Rest@Last@# + Most@Last@#).(Rest@First@# - Most@First@#)/2 &@ Transpose[t] //
 RepeatedTiming
(*
  {0.0004, 2.}
  {0.00050, 2.}
  {0.000093, 2.}
*)