-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix the issue in deleting row without file name #90
Comments
How can you handle errors when
|
Changes in `deleteSelected()`: - Add a condition to check if `item.fileId` is null or empty - Avoid calling DriveApp to delete file if item.fileId is not available - Log a warning message to system log if `item.fileId` is not available Changes in `getSelected()`: - Use early exit to skip the current iteration in the for loop if `isChecked` is false - Retrieve row data from the spreadsheet and include them in the `items` object Fixes issue #90
Symptoms
The
deleteSelected()
function is failing to delete selected log items whenDriveApp.getFileById(item.fileId)
cannot find the file oritem.fileId
is empty. This is causing an error in the script and preventing the deletion of selected items and their files from Google Drive.Instructions for bug fixing
item.fileId
is empty or null before callingDriveApp.getFileById(item.fileId)
.item.fileId
is empty or null, skip the file deletion step and move on to the next item.DriveApp.getFileById(item.fileId)
cannot find the file, log an error message and move on to the next item.Citations:
[1] https://developers.google.com/apps-script/guides/support/troubleshooting
[2] https://stackoverflow.com/questions/37924842/deleting-rows-in-google-sheets-using-google-apps-script
[3] https://support.google.com/docs/thread/101625681/how-to-automate-deletion-of-old-form-responses-from-the-form?hl=en
[4] https://groups.google.com/g/google-apps-script-community/c/SHAYPU8Cjug
[5] https://community.airtable.com/t5/automations/unable-to-delete-10-records-at-a-time-can-anyone-solve-this/td-p/156592
The text was updated successfully, but these errors were encountered: