Does anyone know of a free source for bankruptcy data? I'm specifically interested in the companies' balance sheets before they filed for bankruptcy.
There is a private database: http://www.bankruptcydata.com/ which appears to have all bankruptcy filings logged. It has a subscription but appears to offer a free trial. To access public court filings in general which would include bankruptcy filings you'll ned access to PACER which is the government's database for all public court filings although it does require an account and charges a fee for each document (https://www.pacer.gov/). In general public bankruptcy filings are likely not going to be offered for free publicly given that it appears there is no official government body which gathers this information.
Your best bet to find balance sheets before bankruptcy is to look at a company's 10K or 10Q SEC filings which includes balance sheets and other required data for publicly traded companies to report to the SEC quarterly. 10K reports are the year end reports and 10Q reports are quarterly reports. The SEC has a useful database for these reports called EDGAR where you can look them up: https://www.sec.gov/edgar/searchedgar/companysearch.html.
Note that the SEC filings only apply to publicly traded companies. Non-publicly traded companies have no requirement to disclose their balance sheets and that information likely isn't available to you.