# Foreach all decks

**URL:** <https://forums.ankiweb.net/t/foreach-all-decks/5013>\
**Category:** Add-ons\
**Created:** [November 11, 2020, 4:39pm UTC](https://forums.ankiweb.net/t/foreach-all-decks/5013 "2020-11-11T16:39:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kayh](https://avatars.discourse-cdn.com/v4/letter/k/58956e/32.png) [@Kayh](https://forums.ankiweb.net/u/Kayh)\
**Post date:** [November 11, 2020, 4:39pm UTC](https://forums.ankiweb.net/t/foreach-all-decks/5013/1 "2020-11-11T16:39:51Z")

</div>

Please, How to foreach all decks?  
Thanks!

---

<div class="post-metadata">

**Author:** ![ijgnd](https://avatars.discourse-cdn.com/v4/letter/i/bbe5ce/32.png) [@ijgnd](https://forums.ankiweb.net/u/ijgnd)\
**Post date:** [November 12, 2020, 11:37am UTC](https://forums.ankiweb.net/t/foreach-all-decks/5013/2 "2020-11-12T11:37:30Z")

</div>

maybe you could expand and reword your post? I have no idea what you mean and since no one has answered yet maybe I’m not the only one.

---

<div class="post-metadata">

**Author:** ![Kayh](https://avatars.discourse-cdn.com/v4/letter/k/58956e/32.png) [@Kayh](https://forums.ankiweb.net/u/Kayh)\
**Post date:** [November 12, 2020, 12:03pm UTC](https://forums.ankiweb.net/t/foreach-all-decks/5013/3 "2020-11-12T12:03:41Z")

</div>

Nice, thank for your answer!  
Can I get all deck’s names from the user collection?

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [November 12, 2020, 12:15pm UTC](https://forums.ankiweb.net/t/foreach-all-decks/5013/4 "2020-11-12T12:15:47Z")

</div>

If you’re asking about add-on development, you can use the `all_names_and_ids` function accessible through `mw.col.decks.all_names_and_ids`

See [https://github.com/ankitects/anki/blob/410987f0a6dacc32d9029e7801a1141b0e6ea434/pylib/anki/decks.py#L133](https://github.com/ankitects/anki/blob/410987f0a6dacc32d9029e7801a1141b0e6ea434/pylib/anki/decks.py#L133)

---

<div class="post-metadata">

**Author:** ![Kayh](https://avatars.discourse-cdn.com/v4/letter/k/58956e/32.png) [@Kayh](https://forums.ankiweb.net/u/Kayh)\
**Post date:** [November 12, 2020, 1:04pm UTC](https://forums.ankiweb.net/t/foreach-all-decks/5013/5 "2020-11-12T13:04:06Z")

</div>

Nice! That’s it!  
Thanks!
