Reason to eat flour/sugar feels too compelling

I would like to give up flour and sugar because I’d like to find out if I feel healthier and more energized without it. But I’m finding it very hard. Each time I’ve tried to give them up I feel very tired and have difficulty functioning. I’m very prone to headaches when hungry and sugar picks me up. In the moment I have a very compelling reason to eat (avoid pain, feel better, function better) and it outweighs my reason to give them up (based on a hope rather than an actual experience of feeling better). I hope that makes sense. How can I move forward?