If you have \$N\$ samples of voltage \$V\$ and current \$I\$, taken at a rate of 10 samples-per-second, then there is an interval \$\Delta t = \frac{1}{10}=0.1s\$ between each pair of consecutive samples.
You have two long lists of voltage readings, \$V_0, V_1 \dots V_{N-1}\$, and the same number of current readings, \$I_0, I_1 \dots I_{N-1}\$), and for each, you can calculate instantaneous power, as you figured out for yourself: \$P = V \times I\$.
Power is the rate of delivery of energy, the number of Joules of energy delivered each second. In other words, if power remained constant at 20W, for a duration of 30s, that means that 20J of energy was delivered during each second, and the total energy delivered must therefore be \$20W \times 30s = 600J\$. The product of power and time tells you the total energy.
It helps to understand the units. Power, or rate of delivery of energy, has the units "joules per second", written \$\frac{J}{s}\$ or \$Js^{-1}\$, but it's rare that you see that. Usually we call that "watts", \$W\$, where "one watt" means "one joule per second", \$1W = 1Js^{-1}\$. They mean the same thing. Notice how if you multiply \$\frac{J}{s} \times s\$, you are left with just \$J\$, energy, so even the units are consistent.
That's why sometimes people use the term "watt-seconds", instead of "joules", because the product of power in watts, and time in seconds, gets you energy, in joules.
Anyway, if we (naively) assume that current and voltage remain constant between each sample, then so does power. To find the energy delivered during that interval it's the product of power \$P\$, and the duration of the interval \$\Delta t\$. So, assuming voltage and current remain constant from the instant we take sample number \$X\$ right up to just before the next sample, energy \$E\$ delivered during that interval is:
$$
\begin{aligned}
E_X &= P_X \times \Delta t \\ \\
&= V_X \times I_X \times \Delta t \\ \\
\end{aligned}
$$
If you perform that calculation for each sample, total energy will be the sum of all those individual "packets" of energy:
$$
\begin{aligned}
E &= V_0I_0\Delta t + V_1I_1\Delta t + \dots + V_{N-1}I_{N-1}\Delta t\\ \\
&= \Delta t(V_0I_0 + V_1I_1 + \dots + V_{N-1}I_{N-1}) \\ \\
\end{aligned}
$$
A neater way of writing that would be:
$$
E = \Delta t\sum^{N-1}_{m=0} V_mI_m \\ \\
$$
Before I go on, the big gotcha is that if you have \$N\$ samples, you might think you have \$N\$ intervals, but actually you only have \$N-1\$, so the total time elapsed between the first and last samples is only \$(N-1) \times \Delta t\$. Watch out for that.
Less naively, instead of assuming that voltage and current remained constant during the entire interval following a sample, we could take two samples, and assume that the voltage and current during the interval between them transitioned smoothly from one value to the next. To do this, we take the average of two consecutive samples, and sum all those averages:
$$
\begin{aligned}
E =& \left(\frac{V_0+V_1}{2}\right)\left(\frac{I_0+I_1}{2}\right) \Delta t + \left(\frac{V_1+V_2}{2}\right)\left(\frac{I_1+I_2}{2}\right) \Delta t + \dots + \left(\frac{V_{N-2}+V_{N-1}}{2}\right)\left(\frac{I_{N-2}+I_{N-1}}{2}\right) \Delta t \\ \\
=& \frac{\Delta t}{4}\left[ \vphantom{\frac{}{}} (V_0+V_1)(I_0+I_1) + (V_1+V_2)(I_1+I_2) + ...
+ (V_{N-2}+V_{N-1})(I_{N-2}+I_{N-1}) \right] \\ \\
=& \frac{\Delta t}{4}\sum^{N-1}_{m=1} (V_{m-1} + V_m)(I_{m-1} + I_m) \\ \\
\end{aligned}
$$