Is it possible to hardwire under the cabinet lights to a switch

that is, instead of wiring a plug to a switch, and then plugging the lights into that plug, is it possible to just wire the lights to the switch?
The reason I ask is, we are putting lights on both sides of our kitchen (the kitchen is vertical), and there really is no way to connect the lights from one side to the lights on the other without going though the attic. The guys at HD said that if I go through the attic, I should be using 14 or 12/2 wire. Can I do this, and if so, since the undercabinet lights use I'm assuming 18 gauge wire, do I just wire one to the black, and one to the white? And since I have to use the 12/2 wire, I was just going to hardwire it to a plug, instead of an outlet (since it's going to be a real pain to wire the outlet to the plug now).
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
The short answer is, yes, you can wire under-counter lights into a wall switch. That's what we did in our recent kitchen renovation, and the results are very pleasant. We used halogens, and the installation also included a transformer.
But I got lost in the rest of your description. Your phrasing suggests you may not be an experienced electrician, so my advice is not to try and be creative -- it may be worthwhile to have a licensed electrician do this job for you. At least in this area (Central Florida) it would be an inexpensive bit of repair work, and I'd be tempted to bundle up all the electrical jobs I could think of (e.g., repair a bad switch, replace a failed GFCI, and run power to a new outdoor storage shed) and have a licensed electrician come in and tackle them all at once, while I spent my time on other "honey-do" items. -- In fact, once the local electrical contractor finishes his backlog of hurricane-related repairs, that's exactly what I plan on doing. Regards --

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

HomeOwnersHub.com is a website for homeowners and building and maintenance pros. It is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.