Delete sheet script not working!

975 views
Skip to first unread message

Eric Morandeau

unread,
Apr 3, 2023, 8:06:19 AM4/3/23
to Google Apps Script Community
Hi!

Im having trouble getting a delete sheet script to work.


Would really appreciate a some help!


Nerio Villalobos

unread,
Apr 11, 2023, 4:20:35 AM4/11/23
to google-apps-sc...@googlegroups.com
Hello!

I reviewed your post and the script you provided. It seems that the issue is caused by an incorrect sheet name specified in the script.

In your script, you have defined the variable "sheetName" as "Prospects". However, in the error message you received, it says "We're sorry, Prospects doesn't exist. Please enter an existing sheet name."

Please make sure that the sheet name in your script matches the actual sheet name in your spreadsheet. You can double-check the sheet name by going to the tab in your spreadsheet and looking at the name in the tab.

Here is an updated version of your script with the corrected sheet name:

function deleteSheet() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheetName = "Sheet1"; // Replace with the actual sheet name
  var sheet = ss.getSheetByName(sheetName);
  ss.deleteSheet(sheet);
}

Please give this a try and let me know if you still have any issues.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/a936146a-16c6-40a8-88e5-74f5c9043738n%40googlegroups.com.


--
__________________________
Nerio Enrique Villalobos Morillo
Buenos Aires, Argentina

Eric Morandeau

unread,
Apr 15, 2023, 1:57:42 PM4/15/23
to google-apps-sc...@googlegroups.com
Hi!

This doesn't resolve the issue im afraid.

If you look through the conversation and my recent repost to Georg you get the picture of the problem.

I think that your proposal would delete the sheet for sure but there are conditions that needs to be met in order to do the deletion.

Let me know if you have any other ideas.

Best regards

Eric

You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/_rVHtYS_L6U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAC4ZdVEM_xPj90ce2sOKe-O7QP%2BvwVhp8Z%2B0-YH_-UVrqPo4eQ%40mail.gmail.com.


--

mynewsdesk.com 
Eric Morandeau
Account Executive
Mob nr: 070-781 92 34
Rosenlundsgatan 40
118 53 Stockholm
Sverige



DIGITAL COMMUNICATIONS & PR MADE EASY
Simplify your workflow, expand your influence and get results with one complete communications solution.
Monitor what’s being said. Create and publish stories. Engage with your audience. Analyze results.

www.mynewsdesk.com
Your personal data will be processed in accordance with GDPR (EU 2016/679). For more information, please read our Privacy Policy.

Nerio Villalobos

unread,
Apr 15, 2023, 4:35:02 PM4/15/23
to google-apps-sc...@googlegroups.com
Hello!

I can't see Georg's message, much less I can see the image of the error, since that would help me a lot to understand the situation

However, if you tell me everything related to the conditions that must be met to carry out the deletion, I would take them into account in the script, unfortunately I do not have a complete context of what you want, if you can be more explicit and clear with much glad I help you much more.

Regards,

CBMServices Web

unread,
Apr 15, 2023, 6:03:58 PM4/15/23
to google-apps-sc...@googlegroups.com
Have already sent one solution to Eric but he was indicating it was not triggering on the right cell. So that will need to be adjusted which am about to do.


Reply all
Reply to author
Forward
0 new messages