The basic difference between Optical and Electronic Band Gap can be derived from their definition. Optical bandgap tells us if any photon energy is sufficient to create exciton between electron and hole. But this does not ensure that the energy is sufficient to separate the electron and hole because they are bound by Coulomb energy. In broad sense it can be said that optical and electronic bandgaps are identical in direct bandgap materials but for indirect bandgap materials, electronic bandgap is greater than the optical bandgap.
Another important difference is their provided information. The electronic bandgap provides details about density of states in the solid where optical bandgap provides bulk information and useful mostly to predict the type of bandgap (by using tauc plot as well as kubelka-munk func). This is obvious because when we measure optical bandgap, we try to excite the material by photon energy in a range of UV to NIR. The exciton happens so fast and for this reason we cannot get enough time to analyze the exciton.
On the other side, when we measure electronic bandgap, we knock out electrons from the valence edge by photoemission (or from conduction edge by inverse photoemission), we thus get enough time to observe and analyze the excited electronic states. For example, the photon energy used for HARPES (Hard X-Ray Angle Resolved Photoemission Spectroscopy) is around 3000 eV which knock out the electron from bulk material and is capable to depict the density of states in a fascinating way. To compare this with optical bandgap, the photon energy of visible range can be mentioned for example which is only 1.8 to 3.2 eV.
However, I would like to suggest you to go through the previous discussion specially the answer given by Prof. Wegner.
If you do not consider the excitonic interaction (an electron and a hole interact by Coulomb interaction) in the calculation of the band structure, the obtained bandgap is the electronic bandgap. In contrast, in the presence of excitons, a few energy states appear in the forbidden energy band. Here, the difference between VBM and CBM which are formed by excitonic states is optical bandgap.
Yambo is a code for calculation of the electronic structure considering the excitonic interaction.