I'm cleaning our Marketing Cloud instance and I have a folder containing more than 1.450 data extensions I'd like to delete. I need to delete both contacts and the data extensions.

I was wondering if there is a way to mass delete everything at once, instead of picking one DE by one in the contact delete section in Contact Builder. Another option would be to put everything together in one unique DE using a query, but again it's too many DEs with different primary key names. Two really time consuming options.

Any ideas? Thank you very much in advance!

  • How about ssjs? Jan 30 at 9:56
  • Thanks Swati, I'm not aware of any ssjs function that allows to delete all contacts in many data extensions at once - I know how to do this one by one but of course with so many data extensions this can take a long, long time. Can you elaborate, please? Thank you! Jan 30 at 11:55

1 Answer 1


If you just need to delete contacts, using contact deletion will automatically identify all the relevant contacts across all sendable data extensions. You can easily automate this by uploading all the Contact Keys you want deleted, into a single sendable data extension, and use the script I have shared here:


Deleting entire data extensions is a more demanding task, as you will need to identify the names of all the extensions you need deleting, and listing them all in a similar way. The script for bulk DE deletion can be found here:


  • Thanks Lukas! This is very useful, I was already aware of this script. However, my main problem is that I would need to join more than 1.400 data extensions into one unique one.. Any tips to get this done without needing a massive manual SQL query? THANK YOU! :) Jan 30 at 11:53
  • @BlancaEscalera Usually you shouldn't need to join these into one, as you probably have a single source of truth for all your contacts (e.g. Sales Cloud, your e-commerce site or something third). You should not be digging through single data extensions. Unless there is a fundamental issue with your system architecture.... Jan 30 at 12:02
  • Unfortunately is has to do with the architecture... this is the way to solve an issue that has been going on for years, with some SFMC users uploading contacts with a different ID (not SF ID). I finally managed to get an idea of which of those contacts can we delete. Nothing easy like "SubscriberKey contains @", unfortunately... Jan 30 at 12:15
  • If these contacts have been sent to, you can query them in all subscribers list @BlancaEscalera Jan 30 at 14:08
  • It’s not that easy since they don’t meet any specific criteria. They just belong to really old data extensions and use random subscriber keys. I guess I will need to delete each one manually. Thank you very much in any case! :) :) Jan 30 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .