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?