A version of the World Cup 2018 spreadsheet from www.excely.com, but which uses yellow and red cards to decide ordering in the group if all other criteria are equal. Which is the right way to do it. The original spreadsheet uses FIFA rankings, which are no longer relevant.
The easiest way to get hold of the spreadsheet is to click on world_cup_2018_full_results_fp.xlsx and then click the Download button.
Yellow and red card data can be entered on the Settings page. This data is obviously is only used if there actually is a tie by other criteria, so only NEEDS to be entered where that is the case. At the time of writing it has a copy of the data from Wikipedia.
If red/yellow cards are also equal after the group stages in reality the higher-placed team will be drawn by lots. In the spreadsheet teams are simply ordered by alphabetical order in English in the very unlikely event that this happens. A workaround is just to give the ballot-losing team a few extra red cards if they still appear higher in the group.
Note that FIFA rules state that a yellow followed by a straight red is worse than just a straight red. In Settings this needs to be entered as one yellow AND one straight red as a result.
This sheet won't work with the comparison tool on excely's website.
Disclosure: I have no connection with excely, I just did this as an Excel challenge.