However the reality is that luck has more to do with it. The large scale European balance of power and geography made this possible.
Switzerland is bad for going North to South and if you move East to West its better to stick with the North European plain.
Comparing Belgium and Switzerland before WW1 shows this. Both were ready to defend their borders, and you couldn't just walk in.
However it just so happens that Germany was fighting France and Russia.
In the Napoleonic wars some action was happening in Switzerland (Russian armies in Switzerland) but even then it was limited.
That a lot of money, the Nazi stole from others, was stored on swiss banks could have helped also.
This is a oft repeated myth. Switzerland would have been conquered within a day by any major power in ww1 or ww2. The reason why switzerland isn't conquered is because they serve as a money laundering/transfer center for every power. Swizterland's "defenses" are for show. Swizterland's shield is it's dependable position as banker for nations and the elites.
And if you have ever looked at the modern american army in afganistan then you will know that you can't just show up with some people and resources and take everything over.
Effective defense is about causing more pain then it is worth conquering you.
Also lets remember that in WW1 Netherlands was not attacked either in WW1. Generally its just not worth attacking small neutral countries.
Banking is just one of many aspects, its simply false to claim that it is the major reasons.