Writing xlsx file issue

Please find test file attached to below solution.