Exporting entries to spreadsheet

Exporting entries to spreadsheet

by Itamar Tzadok -
Number of replies: 0

I've finally managed to get the dataform export to work as I want, or at least close enough. The point was to use the portfolio API as a uniform way for exporting dataform content and especially exporting to csv/ods/xls.

The approach puts a fair portion of the burden of generating a correct export on the user. But in return it offers high flexibility and efficiency in that columns may be ordered as the user sees fit and export templates persist and may be re-used.

The user creates a template for the export as a view. This would typically require the extended-block view (similar to the database activity template with a header section, repeated entry section and a footer section) such that the csv header is entered in the header section and the csv record in the repeated entry in plain text mode. Each column is marked by a field tag. The delimiter may be any character or even any string, but certain characters are more useful as delimiters than others. Thus for instance a tab delimited text is recognized by excel and so the generated file may be saved with xls extension. Special characters selector allows for adding tabs as delimiters. Csv format works with a comma but can also work with other characters such as | and there are certain ways to make excel recognize the delimiter correctly.

The export generates a text file and assigns to the downloaded file one of the extensions (csv, xls, ods) according to the user's selection. Again, with tab as the delimiter and xls as the selected extension the export effectively sends the content directly into excel file (without the need for writer libraries). smile

Average of ratings: -