{"action":"created","issue":{"url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/332","labels_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/332/labels{/name}","comments_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/332/comments","events_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/332/events","html_url":"https://github.com/jmcnamara/XlsxWriter/issues/332","id":129136898,"number":332,"title":"Excel file seems to be corrupted","user":{"login":"benzid-wael","id":4288931,"avatar_url":"https://avatars.githubusercontent.com/u/4288931?v=3","gravatar_id":"","url":"https://api.github.com/users/benzid-wael","html_url":"https://github.com/benzid-wael","followers_url":"https://api.github.com/users/benzid-wael/followers","following_url":"https://api.github.com/users/benzid-wael/following{/other_user}","gists_url":"https://api.github.com/users/benzid-wael/gists{/gist_id}","starred_url":"https://api.github.com/users/benzid-wael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benzid-wael/subscriptions","organizations_url":"https://api.github.com/users/benzid-wael/orgs","repos_url":"https://api.github.com/users/benzid-wael/repos","events_url":"https://api.github.com/users/benzid-wael/events{/privacy}","received_events_url":"https://api.github.com/users/benzid-wael/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jmcnamara/XlsxWriter/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"jmcnamara","id":94267,"avatar_url":"https://avatars.githubusercontent.com/u/94267?v=3","gravatar_id":"","url":"https://api.github.com/users/jmcnamara","html_url":"https://github.com/jmcnamara","followers_url":"https://api.github.com/users/jmcnamara/followers","following_url":"https://api.github.com/users/jmcnamara/following{/other_user}","gists_url":"https://api.github.com/users/jmcnamara/gists{/gist_id}","starred_url":"https://api.github.com/users/jmcnamara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmcnamara/subscriptions","organizations_url":"https://api.github.com/users/jmcnamara/orgs","repos_url":"https://api.github.com/users/jmcnamara/repos","events_url":"https://api.github.com/users/jmcnamara/events{/privacy}","received_events_url":"https://api.github.com/users/jmcnamara/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-01-27T13:05:04Z","updated_at":"2016-01-28T21:02:57Z","closed_at":null,"body":"When I try to open the workbook with Open Office, I got:\r\n\r\n```\r\nExcel could not open Employee (1).xlsx because some content is unreadable. Do you want to open and repair this workbook?\r\n```\r\n\r\nBelow, the repair log:\r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<recoveryLog xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><logFileName>Repair Result to Employee (1)0.xml</logFileName><summary>Errors were detected in file '/Users/wael/Downloads/Employee (1).xlsx'</summary><additionalInfo><info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info></additionalInfo></recoveryLog>\r\n```\r\n\r\nHow to fix it ?"},"comment":{"url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/comments/176415154","html_url":"https://github.com/jmcnamara/XlsxWriter/issues/332#issuecomment-176415154","issue_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/332","id":176415154,"user":{"login":"jkyeung","id":4826859,"avatar_url":"https://avatars.githubusercontent.com/u/4826859?v=3","gravatar_id":"","url":"https://api.github.com/users/jkyeung","html_url":"https://github.com/jkyeung","followers_url":"https://api.github.com/users/jkyeung/followers","following_url":"https://api.github.com/users/jkyeung/following{/other_user}","gists_url":"https://api.github.com/users/jkyeung/gists{/gist_id}","starred_url":"https://api.github.com/users/jkyeung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkyeung/subscriptions","organizations_url":"https://api.github.com/users/jkyeung/orgs","repos_url":"https://api.github.com/users/jkyeung/repos","events_url":"https://api.github.com/users/jkyeung/events{/privacy}","received_events_url":"https://api.github.com/users/jkyeung/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T21:02:57Z","updated_at":"2016-01-28T21:02:57Z","body":"@benzid-wael: In case it was not clear, you have to provide a script such that we can run it ourselves, on our own machines, *without providing our own data*, and wind up with an Excel file which exhibits the problem you're encountering. Your script has to create the file, from beginning to end, including data.\r\n\r\nThat being said, I will take pity on you and tell you that this line:\r\n\r\n    with open(temp_path, 'r') as report_file:\r\n\r\nopens the file in text mode, which definitely won't work. You need to use binary mode. That alone might fix your problem. If not, you need to come back with a *complete* script demonstrating the problem."}}