A scalable preparation of in situ N-doped disordered carbon nanosheets from reduced melamine formaldehyde resin is demonstrated. For the first time, nanosheets prepared by such a process have been tested as anodes for lithium ion and sodium ion batteries. Li-ion battery half-cell delivers a reversible capacity of about 500 mA h/g at a specific current of 100 mA/g, and also a capacity of 250 mA h/g at a specific current of 500 mA/g is retained after 600 cycles. For Na-ion batteries, a reasonable capacity of about 150 mA h/g is recorded at a specific current of 50 mA/g, and a capacity of 120 mA h/g at a specific current of 250 mA/g is retained after 350 cycles. The sloppy low-voltage profile obtained for both the lithium ion and sodium ion cells corresponds to the nanosheet anodes, being soft carbon-like, thereby demonstrating superior cycling stability and safety by avoiding metal plating and dendrite formation.