A reformatting error in an Excel spreadsheet has cropped up in the largest bankruptcy case in U.S. history, prompting a legal motion by Barclays Capital Inc. to amend its deal to buy some of the assets of Lehman Brothers Holdings Inc.

The law firm representing Barclays filed the motion (download PDF) on Friday in U.S. Bankruptcy Court for the Southern District of New York, seeking to exclude 179 Lehman contracts that it said were mistakenly included in the asset purchase agreement. The firm — Cleary Gottlieb Steen & Hamilton LLP — said in the motion that one of its first-year law associates had unknowingly added the contracts when reformatting a spreadsheet in Excel.

At the time when the error occurred, Cleary Gottlieb was working under a tight deadline put in place by the bankruptcy court to submit the purchase offer from Barclays, according to the motion. The mistake was discovered Oct. 1 and was first reported by Above the Law, a legal news Web site.

A representative of the law firm declined to comment about the matter today.

Lehman Brothers declared bankruptcy on Sept. 15, in the first of a series of blows to the financial sector that quickly led to the meltdown of stock markets worldwide. Three days later, Barclays agreed to acquire some of the U.S. assets of the financially strapped investment bank.

"This court has previously recognized the exigent circumstances surrounding the sale order and the harm to the financial markets that would have resulted had this deal not been completed quickly," Cleary Gottlieb said in Friday's motion. It added that the parties to the deal "were working literally around the clock on an extremely compressed schedule." In light of those circumstances, the law firm asked the bankruptcy court to "correct the record to accurately reflect" the list of Lehman contracts that Barclays meant to include in the deal.

According to the motion, Barclays sent the spreadsheet containing the list of contracts to Cleary Gottlieb at 7:48 p.m. EDT on Sept. 18. The spreadsheet — which contained almost 1,000 rows of data with a total of more than 24,000 individual cells — needed to be reformatted and converted into a PDF file so it could be posted on the bankruptcy court's Web site before midnight. At 11:37 p.m., Cleary Gottlieb sent the converted file to the court, the motion said.

However, contracts that had been marked as "hidden" in the spreadsheet when it was received by the law firm were added to the purchase offer during the reformatting process, according to the motion. Those contracts weren't supposed to be part of the deal; they also were marked with an "N" for "No" in the original version of the spreadsheet, Cleary Gottlieb said in the motion.

A hearing on the motion has been scheduled for Nov. 5.

Spreadsheets have long been one of the most popular ways for corporate users to store and analyze data. But over the past few years, they have played an increasing role in data breaches because workers are apt to store them unsecured on laptops. In addition, hackers have actively tried to exploit vulnerabilities in Excel.