The new Code Execution is so exciting! Eksekusi kode | Gemini API | Google for Developers
However, I realized that Code Execution doesn’t work with CSV yet. The Python code the code execution generates will always want to refer to some imaginary csv filename, instead of referring to the given uploaded csv filename. It is so frustrating.
Can you fix it? or can you show me some working code to correctly use code execution on csv file? I want to do standard query on csv file, calculating average, finding maximum, counting records, etc.
Welcome to the forums!
You don’t show the code you tried to use to access the CSV, but your comment “instead of referring to the given uploaded csv filename” might give a clie to what isn’t working and how to resolve.
It sounds like you’re including the csv file through a file upload with a fileData
part?
If so, keep in mind that by the time Gemini sees this, it is already combined with the data from other parts of your prompt. It doesn’t see it as a “file” and certainly doesn’t see the filename.
Instead, try referencing it directly as part of the prompt. Perhaps something like:
Generate and run code for the following numbers:
Good luck!
Hey @lawrenceteo the model cannot see files you pass to it right now, it can look at data from a prompt, but files are not supported at the moment.
Thanks for confirming that file isn’t supported in code execution at the moment. Do you have a roadmap and timeline when file will be supported in code execution?
You missed the other part of what Logan said. “it can look at data from a prompt”. The file, once included, is part of the prompt. It is no longer a file.