[GH-ISSUE #235] call workbook_close somtimes not create xlsx file #189

Closed
opened 2026-05-05 11:51:46 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @myseemylife on GitHub (Jun 13, 2019).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/235

Originally assigned to: @jmcnamara on GitHub.

I have inserted 19000+row data ,6 colums,then call workbook_close,but the lib not always create the file successfully.after 2 hours debug,in iowin32.c line 185.
hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); the handle is NULL.
GetLastError = 32. need help

Originally created by @myseemylife on GitHub (Jun 13, 2019). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/235 Originally assigned to: @jmcnamara on GitHub. I have inserted 19000+row data ,6 colums,then call workbook_close,but the lib not always create the file successfully.after 2 hours debug,in iowin32.c line 185. ` hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); ` the handle is NULL. GetLastError = 32. need help
gitea-mirror 2026-05-05 11:51:46 -06:00
Author
Owner

@jmcnamara commented on GitHub (Jun 14, 2019):

According to this MS Doc Error 32 is:

ERROR_SHARING_VIOLATION

    32 (0x20)

    The process cannot access the file because it is being used by another process.

Is the file already open in Excel?

Also, can you put this as the close() for your application and let me know the output:

   lxw_error error = workbook_close(workbook);

    /* Check if there was any error creating the xlsx file. */
    if (error)
        printf("Error in workbook_close().\n"
               "Error %d = %s\n", error, lxw_strerror(error));
<!-- gh-comment-id:502064474 --> @jmcnamara commented on GitHub (Jun 14, 2019): According to this [MS Doc](https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--0-499-) Error 32 is: ``` ERROR_SHARING_VIOLATION 32 (0x20) The process cannot access the file because it is being used by another process. ``` Is the file already open in Excel? Also, can you put this as the close() for your application and let me know the output: ```C lxw_error error = workbook_close(workbook); /* Check if there was any error creating the xlsx file. */ if (error) printf("Error in workbook_close().\n" "Error %d = %s\n", error, lxw_strerror(error)); ```
Author
Owner

@jmcnamara commented on GitHub (Jul 29, 2019):

Closing due to lack of feedback.

<!-- gh-comment-id:515898482 --> @jmcnamara commented on GitHub (Jul 29, 2019): Closing due to lack of feedback.
Author
Owner

@myseemylife commented on GitHub (Aug 23, 2019):

Sorry Disappeared for many days~
I reproduce the case today,got error = LXW_ERROR_CREATING_XLSX_FILE,
OS: Win10 64bit @jmcnamara .
I can make sure that I got permissions on the destination dir.
I run Administrator account.

<!-- gh-comment-id:524162438 --> @myseemylife commented on GitHub (Aug 23, 2019): Sorry Disappeared for many days~ I reproduce the case today,got ` error = LXW_ERROR_CREATING_XLSX_FILE`, OS: Win10 64bit @jmcnamara . I can make sure that I got permissions on the destination dir. I run Administrator account.
Author
Owner

@jmcnamara commented on GitHub (Aug 23, 2019):

What is the full printf output from the error code above?

<!-- gh-comment-id:524164063 --> @jmcnamara commented on GitHub (Aug 23, 2019): What is the full printf output from the error code above?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#189
No description provided.