He funded his gambling by taking cash out of a safe and inflating the figure that was still in there -- or taking a few notes out of bundles.
A court heard how Paddy Power thought he was a valued customer and took him on trips to the Aviva Stadium and Punchestown.
The scam was uncovered when gardai printed out his betting account and saw a series of huge and sometimes obscure bets.
O'Reilly has pleaded guilty to six offences of theft at Gorey Post Office and is awaiting sentencing.
O'Reilly, with an address at Sandhills, Hacketstown Road, Carlow, also pleaded guilty to six charges of falsifying An Post lodgement dockets for accounting purposes between December 6, 2010, and June 29, 2011.
Detective Garda Ian Hayes told a court of the theft of sums of cash from An Post on dates during 2010 and 2011 which were spotted after an internal audit.
Gardai received a phone call alerting them that O'Reilly had not turned up for work and had apparently been in a crash.
It was at that time, said Det Hayes, that he was informed that funds were missing.
Gardai and An Post both launched full investigations into the missing €1.7m while warrants were executed on Paddy Power bookmakers and a private house.
Det Hayes said they located a 'Tony Ten' account which was an account owned by Tony O'Reilly. They obtained a printout of the account.
There was evidence, he said, of a turnover in the account of €10m with €8.3m winnings leaving a €1.7m loss.
Towards the end of the timeframe the bets were sporadic and included various sports.
There was one bet of €40,000 on the Norwegian Ladies soccer team which was on June 9, 2011 and this was indicative of the type of betting taking place.
When O'Reilly returned home, the gardai spoke with him at the home of his solicitor, John O'Sullivan.
The court heard that O'Reilly went through the whole matter -- how he had made the bets and how he covered the losses.
Det Hayes said the defendant owed €60,000 by September 2010 and by December the loss was about €290,000. Between January 2011 and June that year the figure went up to €1.7m.
Defence Counsel Patrick McCarthy said the defendant is a married man with one child, and lived in what could be described as a family home with no extravagance.
It appeared he had an extremely serious gambling problem, and given the amount owed there is no prospect of getting all the money back. He also told the court that Paddy Power looked upon him as a valued customer.
He also said that his guilty plea had saved the State a considerable amount of money.
Judge Pauline Codd said she would remand the defendant in custody for sentencing at Wexford Circuit Criminal Court.