Elon Musk negotiated a sale of Tesla to Google and shook hands on the talks, but a deal never came together in the end, according to a new book about the Tesla CEO.

Orders for Tesla Model S swooned in early 2013, as word of mouth spread that the electric cars were glitchy and not ready to compete with other luxury brands. Tesla (TSLA) had just two weeks worth of cash left, it had shut down its factory, and the company was in dire need of a bailout.

In the soon-to-be-released book "Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future," Bloomberg reporter Ashlee Vance wrote that Musk met his friend, Google CEO Larry Page, and started to negotiate a deal to sell Tesla to Google in March 2013. An excerpt of the book was published in Bloomberg Businessweek Monday.

Musk's proposal, according to Vance, included $6 billion for the company in addition to $5 billion to be spent on expanding Telsa's factories. Musk also demanded that Google keep him on as Tesla's CEO for eight years or until Tesla built a third-generation electric car that would be sold to mainstream car buyers. Google (GOOGL) had to keep Tesla operational until that car hit the road, Vance reported.

Page and Musk shook on the general terms of the negotiation, and the companies' lawyers started crafting the deal. It's not clear exactly how close the companies actually came to merging -- Vance noted that Musk's financial demands created "sticking points ... and kept the two sides apart."

Meanwhile, Tesla's sales picked up, and the company posted $562 million in sales and an $11 million quarterly profit in the first quarter of 2013. Musk then told Page thanks, but no thanks.