Bug 39394 - Client-side conversion of CSV to Excel and ODS formats
Summary: Client-side conversion of CSV to Excel and ODS formats
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-20 09:28 UTC by Mathieu Saby
Modified: 2025-11-12 15:42 UTC (History)
2 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Saby 2025-03-20 09:28:49 UTC
Since ODS generation can cause issues (https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23685), and Excel generation is not currently possible, why not using libraries such as https://sheetjs.com/ (and other tools like https://www.papaparse.com/ or web workers for big files?) to convert the generated CSV to Excel or ODS in the browser ?

It could be used for reports but also other CSV generated by Koha.

We will try this approach in my library, as a local customization.
Comment 1 trevor.diamond 2025-11-11 14:40:10 UTC
Maybe this isn't the place (and I would be happy to take this elsewhere) but WHY is it "currently not possible" to get Excel files from reports?  Basically any table in Koha has 4 export options: Excel, CSV, Copy, Print.  It's a little odd to not also see the Excel option when trying to download a report result. 

This bug is addressing a gap in Koha that I would like to better understand why the gap exists, but if this is the best way to resolve the missing format, then I will follow this bug with interest!
Comment 2 Mathieu Saby 2025-11-11 16:00:52 UTC
I believe the perl libraries for exporting in Excel format are very old and could cause memory issues.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23685#c7
Comment 3 Owen Leonard 2025-11-12 13:32:52 UTC
(In reply to trevor.diamond from comment #1)
> but WHY is it "currently not possible" to get Excel files from reports? 
> Basically any table in Koha has 4 export options: Excel, CSV, Copy, Print.

Just to clarify a little about why these things are different: tables which offer the Excel, CSV, etc. option are controlled by a third-party JavaScript library (DataTables) which includes this functionality.

Saved SQL report results don't use the DataTables plugin because such reports could have thousands of results, and parsing that amount of data client-side with the DataTable plugin could crash the browser.

Saved SQL report results are instead processed by Perl scripts in order to produce the requested file format for download. For this we depend on a third-party Perl library.
Comment 4 trevor.diamond 2025-11-12 15:42:42 UTC
Thanks for providing this context, yall!