XLSX Files not supported for File Upload API

I’ve been trying to upload an excel file via the API for analysis with the code interpreter tool, however the response from the API is that the file type isn’t supported.

filename = "tables.xlsx"
cw_file = openai.files.create(
    file=open(filename, 'rb'),
    purpose='assistants',
)

This code block works fine for .csv and .docx files however xlsx files return the following error:

BadRequestError: Error code: 400 - {'error': {'message': "Invalid file format. Supported formats: ['c', 'cpp', 'csv', 'docx', 'html', 'java', 'json', 'md', 'pdf', 'php', 'pptx', 'py', 'rb', 'tex', 'txt', 'css', 'jpeg', 'jpg', 'js', 'gif', 'png', 'tar', 'ts', 'xlsx', 'xml', 'zip']", 'type': 'invalid_request_error', 'param': None, 'code': None}}

It explicitly states .xlsx is supported in the error message so it seems like a bug. Has anyone been able to successfully upload an Excel file to the /files API?

2 Likes

Thank you for posting, lwoodroberts, I am getting the same error both in CURL / Py. I was able to run a raw request via insomnia with a PDF file, but Excel blows up - also doesn’t matter which version of Excel file it is - same error with 97, 2003, 365, OpenOffice ODT :frowning:

Hope it get fixed soon.

A bit more insights on that: https://chat.openai.com/share/8d081ba9-80e8-4c18-89ed-d63d82cb2975

Looks like it’s not working for large/complex Excel files. Small and easy ones upload just fine.

3 Likes

It has been weeks since this was reported. Has there been no response from OpenAI?

3 Likes

My team is experiencing the same issue, has there been any progress on xlsx files being supportered?

1 Like

The issue seems to have become resolved. I tested uploading an XLSX file using the same code in my application and it worked fine.

Does the api accept xlsx files both at the prompt and output?

this is still an issue despite that chatgpt now works with .xlsx files and the accepted format doc is now updated https://platform.openai.com/docs/assistants/tools/file-search/supported-files
Has anyone idea of when this is would be resolved in the vector store api?

1 Like

Hi there @cjaballah and welcome to the Forum!

.xlsx files are supported under the Assistant, however the approach for uploading them is slightly different compared to other files. You cannot attach .xlsx files to the vector store. Instead, you need to attach them to the code interpreter. For that to work, the code interpreter needs to be enabled.

For some additional details, you can also have a look at this thread where we’ve recently addressed the issue:

2 Likes

Thank you for providing insights. Im intending to use the .xlsx files to retrieve certain information from, this is usually intuitive with file search tool. However, using code interpreter even with instructions doesnt do the required work. Is there something Im doing wrong?