Check out example codes for "google sheets how to send a formula to the bottom of the data". It will help you in understanding the concepts better.
Code Example 1
As long as the formula you want to apply on the column of data is in a cell immediately to the right of the column of data (and the cells below it are empty), simply double-click the fill handle (the little blue box that appears in the bottom right corner of the formula cell) and the formula will be applied to the column until it reaches the end of the data.
Learn ReactJs, React Native from akashmittal.com