The ability of static energy to affect a material depends upon how well it can ionize and conduct electricity.
Salt conducts because it can easily ionize into Na+ and CL-. the Cl atom "steals" Na's outer electron, forming a Na+ ion, which attracts new electrons introduced into the water. Sugar, C12H22O11, on the other hand can not ionize because the atomic bonds between its atoms are very tight covalent bonds.
Static electricity carries a slightly - ionic charge and NaCl carries a slightly + charge. opposites attract.... whereas, depending on the molecular composition of the sugar and type of suguar (glucose, sucrose, fructose) carries a nuetral or - charge.