Enable `.csv` to spreadsheet conversion
Just as a reminder to follow along
- We need this for AI tasks
- Needs some more research / check back with Collabora as
.csvmight need some specific format/separators - Needs some implementation to add the mime types
I have an issue open with Collabora right now to enable passing data such as a delimiter, etc. along with the convert-to request: https://github.com/CollaboraOnline/online/issues/11440
- [ ] Check if auto import was improved, or if we need to finetune parameters, otherwise close this one
I gave it some testing, and it does not automatically detect the separator or anything, but we can now at least specify some sane defaults. This would at the very least work in the case of the AI spreadsheet generation, as we can make sure that the LLM produces only CSV files with a certain field separator, text delimiter, etc.
You can't pass JSON yet, so it is sort of unreadable in its current form -- you have to specify ASCII codes for the field separator, text delimiter, and character set:
Field separator: ,
Text delimiter: "
Character set: UTF-8
curl -k -F "[email protected]" -F "format=ods" -F "infilterOptions=44,34,76,1" https://cool.local:9980/cool/convert-to > output.ods
It's not that easy to reason about, at least it wasn't for me at first. Seems like JSON support is planned but for now this is what made it in.
https://github.com/CollaboraOnline/online/pull/12011 https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options#Filter_Options_for_the_CSV_Filter
@juliusknorr @julien-nc
For the normal file conversion we introduced via the file action menu or API, we could either just assume the defaults and hope for the best or present the user with some kind of import dialog on our own (but that seems a bit too complex right now). Not sure how to proceed there for now unless the field separator auto detection logic is also applied to the convert-to API on Collabora's side.
AI related parts good enough I'd say. For general file conversion it is then rather tricky without having options implemented for the conversion API on the Nextcloud side.
I went ahead and made a pull request to introduce it for the AI-generated spreadsheets at least: https://github.com/nextcloud/richdocuments/pull/4843