Adding row to another table adding rows after blank spaces

I'm having an issue with the data action adding rows to another table using rows from this table. When the button is clicked, the rows are added to the new table; however, they are added after blank spaces. Sheet 1, where the data is coming from is inside an application. Sheet 2, is just a connection to a spreadsheet that we are still using in spreadsheet form. In this sheet, we have blank rows at the bottom where nothing has been entered yet. Previously, we had the patient ID as the key. When this was the case, the app would add the information to the highest row number that was blank. We had to change the Key because we needed to have multiple entries for one patient, so we made the key a dual key of patient ID and date. Now, the app creates a new row at the bottom of the spreadsheet and adds in the data, ignoring several blank rows above it. How do I fix this?

Edit: I've also tried to create a calculated field with UNIQUEID() and I get the same results. 

0 2 601
2 REPLIES 2

More than likely those "blank" rows have spaces in one or more of the cells.  Spaces are enough for the row insertion process to think the row has data in it and will therefore bypass that row when attempting to add a new row.

You have a couple of options.  1)  Select those "blank" rows in the sheet and delete them outright  2)  Select the rows, the entire row, and tap the "Delete" key.  That will remove any "values" leaving a truly blank row.

Some Pro Tips you might find helpful:

1)  If you haven't already, trim your sheets so that unneeded blank columns and all the extra blank rows are removed.  This will actually make the loading of your data more efficient.  To help with this there is a Google Sheet extension that will allow you to Crop your data sheets (see image)

Screen Shot 2022-05-24 at 6.17.38 PM.png

2)  If you are physically deleting a lot of rows, you may want to run an App Script on your sheets to keep them trimmed.  I think you can find an example script in the Community and you can set it to run automatically on a schedule.

3)  When it comes to row keys, I strongly recommend to use a dedicated key column that is not tied to any data - aka a dataless key.  You mentioned already having to change the key to allow for multiple rows per Patient and are now using a concatenated key with the Patient ID and Date.  BUT, you could conceivably need to enter multiple rows for a Patient on the same Date.  Each time you modify the key structure, you risk dis-associating/orphaning detail records.  A system can actually be rendered useless until the data is fixed.  If you use a dedicated key column and assign a value such as the UNIQUEID(), you will never need to worry about modifying row keys again.

I hope this all helps!

Thank you for your solution! I've tried deleting the information out of the blank spaces and it is still adding in after those rows. The operators like to have a filter on the sheet, so we typically keep several blank rows at the bottom to fill in. When we delete the blank rows and have appsheets fill in with a new row, it is not part of the filtered section. 

Thanks for the tips as well! I plan to implement those in our applications moving forward. 

Top Labels in this Space