Just a disclaimer: I did this quite quickly and didn't pay as much attention as I should have to getting photos or getting the size of the tools. Also, this car had 318,xxx miles on the notoriously unreliable Mercedes odometer, meaning some of the bolts or screws might not be original to the car, meaning they might be different than your car. This one was different (and much more straightforward) than other 240Ds I've done, same way I'm sure my 300D is different than this, but the basic concept is the same. Also, it should be pointed out that I have no idea what year this car is, all ID plates were gone. It's your standard, U.S. spec 240D though.
The very first thing I did was get under the car and spray PB Blaster on all the bolts I'd be dealing with. This will help get them loose and doing it first avoids having to wait for the PB to work.
I chose to remove the gearshift assembly, you don't have to. To do that, start by crawling under the car. The three shift rods are held on by clips. Remove them using a flathead screwdriver and the rods slide out. Next, from inside the car, remove the center console where your hazard switch is. This one was held on by two screws near the end of it. Unscrew those, undo the connection to the hazard switch (and the power windows, if applicable) and the console comes out. Next, the actual assembly is held on by four bolts (I believe they're 10mm), undo those, unplug the reverse light switch and the shifter assembly slides out.
Next step (and in my opinion the trickiest) is the driveshaft. At the front, there are six bolts that keep the end of the driveshaft, the driveshaft donut and the output shaft of the transmission in one piece. This is where it can differ greatly from car to car: these were bolts with a 15mm head and a 17mm nut on the end. I've seen w123s that use allen head bolts instead which was an incredibly frustrating setup.
The transmission crossmember has holes provided to slip a wrench in there. Insert the wrench and make sure it goes around the nut. Then, using a ratchet with a 15mm extension, start working away on the bolts. A breaker bar is handy, borderline necessary, to get these bolts loose.
Once you've removed all six bolts, remove the driveshaft mount on the center of the car. This is held on by two 17mm bolts. Softly wiggle the loose end of the driveshaft until it's no longer attached to the transmission.
You'll notice the exhaust is attached to the transmission. Unbolt the two 13mm bolts that hold the mount on and the exhaust will drop. Depending on your car it may be necessary to unbolt the exhaust at the exhaust manifold, too.
Using a 12mm wrench, remove the hydraulic clutch line going into the slave cylinder and remove the speedometer cable. That should be everything attached to the transmission. Except that, wait, it's still attached to the engine.
Start undoing the bolts that hold the transmission on. They're 17mm. Some are simple bolts, some are bolts with nuts behind them, one also has a ground cable. You also need to unbolt the starter bolts which are allen bolts of a size that I cannot recall. You have some coolant hoses in the way for the top bolts. You can work around them, or you can choose to remove them. On a 4-cylinder, you have plenty of room between the engine and the firewall to get to the top bolts. This clearance is MUCH less on a 5-cylinder car and consequently those bolts are tougher to get to.
Double check that all bolts are out (and keep track of them-- don't lose any!) You can now unbolt the transmission mount (which also acts as an engine mount.) These are once again two 17mm bolts and they're the reason why I said above that dropping the exhaust from the exhaust manifold may not be a bad idea, it's easier to get to the passenger side one. You'll naturally notice the transmission start dropping.
Making damn sure you have something to set the transmission down on (couple of old rims and a piece of wood will do), slide the transmission out. It is not light so I'd advise against trying to get it onto your chest.
If you're trying to get to the clutch out, you're not done yet. Get your allen wrench set back out and unbolt the six bolts that hold it on (a breaker bar is handy.) You'll need to block the flywheel so it doesn't move. Once that's off, the clutch slides out.
And, if like me you need to remove the flywheel, you're still not done. There are twelve 12mm bolts that need to be undone. They're very tight and a breaker bar is handy, once again. Use something to block the flywheel and untight them all.
Reassembly is straightforward and is the reverse of disassembly. Align the clutch using the proper tool and it's always good practice to replace the release bearing and the pressure plate. Be VERY careful not to turn the engine the wrong way when torquing the flywheel/pressure plate. Now is also a good time to replace that worn driveshaft donut.