App script throws Those rows are out of bounds. exception

Hi All,

We've  an App sheet application which is used to upload files. It uploads files to a google drive location ,and the uploaded files details are updated to a google sheet  which has unique key ,file name as fields, using which we create a folder with unique key and move the files with the unique key into that. The process of moving the files to the folder runs through a time trigger  which runs every 10 minutes ,for which the google sheet is the reference. After moving the files we delete the rows from the google sheet from bottom to top. But when the trigger is running and if some user uploads the files , Then while deleting the rows it is throwing Those rows are out of bounds  exception .I think this is happening when ever there is a mismatch between the no of rows when the trigger started  ,and if the sheet is updated during the trigger run. 

Could any one help on this. 

Thanks

0 5 2,927
5 REPLIES 5

I would not delete the row on your 10 minute time trigger.  Instead mark the row with a Status value.

Create another time based trigger that runs say at Midnight every day that looks for all rows with that Status value and then delete them.

Thank you. I'll try this.

Hi ,When we try to get the range using sheet.getDataRange(),Some times The coordinates of the range are outside the dimensions of the sheet error occurs. Is the frequent deletion ,the reason behind this error as well.   Your insights on this would be helpful.

Thanks

How are the scripts being triggered?  Do you have multiple triggers happening at the same time?

No ,Only one trigger which runs every 10 mins.

Top Labels in this Space