# 'insertRowBefore' on Balance History; Will it break anything?

**URL:** https://community.tiller.com/t/insertrowbefore-on-balance-history-will-it-break-anything/10370
**Category:** Google Sheets
**Created:** [November 19, 2021, 7:47am UTC](https://community.tiller.com/t/insertrowbefore-on-balance-history-will-it-break-anything/10370 "2021-11-19T07:47:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![m00](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tiller.com/m00/32/6409_2.png) [@m00](https://community.tiller.com/u/m00)
#### Post date: [November 19, 2021, 7:47am UTC](https://community.tiller.com/t/insertrowbefore-on-balance-history-will-it-break-anything/10370/1 "2021-11-19T07:47:25Z")

</div>

Hello,

[Using Foundation Template if that matters.]

I am looking to do some things in Apps Script, and wanted to see if adding a new row at the top (after the headers) of the Balance History sheet using the `insertRowBefore()’ function would break anything.

Any advice?

Thanks!

---

<div class="post-metadata">

### Author: ![eoghann](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tiller.com/eoghann/32/5550_2.png) [@eoghann](https://community.tiller.com/u/eoghann)
#### Post date: [November 19, 2021, 11:40am UTC](https://community.tiller.com/t/insertrowbefore-on-balance-history-will-it-break-anything/10370/2 "2021-11-19T11:40:57Z")

</div>

I have one bank (PNC) that hasn’t been updating for over a month so I manually add rows to Balance History weekly to keep everything in line.

No issues at all.

---

<div class="post-metadata">

### Author: ![m00](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tiller.com/m00/32/6409_2.png) [@m00](https://community.tiller.com/u/m00)
#### Post date: [November 19, 2021, 3:46pm UTC](https://community.tiller.com/t/insertrowbefore-on-balance-history-will-it-break-anything/10370/3 "2021-11-19T15:46:31Z")

</div>

Update with testing: If I add a row right after the header

- `sheet.insertRowsBefore(2,1);`

It breaks _Accounts_ and _Balances_ sheets.  
If I instead insert the row between row 2 and 3, it seems to work OK.

- `sheet.insertRowsBefore(3,1);`

---

<div class="post-metadata">

### Author: ![m00](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tiller.com/m00/32/6409_2.png) [@m00](https://community.tiller.com/u/m00)
#### Post date: [November 19, 2021, 5:00pm UTC](https://community.tiller.com/t/insertrowbefore-on-balance-history-will-it-break-anything/10370/4 "2021-11-19T17:00:54Z")

</div>

I have it figured out, and am going to post here in case it is useful for someone else. There is probably a more elegant way to do this, but this works.

```auto
//add a row in the 'middle' of the balance history sheet
balanceHistorySheet.insertRowsBefore(3,1);
//copy the existing first row down a row
balanceHistorySheet.getRange("A2:M2").copyTo(balanceHistorySheet.getRange("A3:M3"), {contentsOnly:true});
//clear the now-duplicate first row
balanceHistorySheet.getRange("A2:M2").clearContent();

//copy the new balance history entry that I want at the top

```
