Many applications collect all kinds of data, from sales figures and task progress to users' personal details. Systems usually offer a convenient way to browse all of this (for example an admin panel) with filtering, sorting and pagination. Still, there are situations where that is not enough and the data has to be processed in an external tool. And that is not all: we often want to pass, say, sales results to management who have no account in the system, or no way to reach the results themselves, but who need them.

These and many other cases show that systems often need a way to export results, so that you can do something with them outside the application. For many people this is obvious, but it is not always clear what the export should look like, including which file extension the result should have. Some have not thought it through before deciding that such a feature is needed, others only know that they must be able to open it in Excel, and still others ask for a quote on an export without specifying any details, claiming that it makes no difference anyway. Well, it does.

The most popular formats that applications can save data to are:

  • PDF
  • XLS(X)
  • CSV
  • TXT
  • XML
  • JSON

In many cases, when the client cannot say which format they need for exported files, it is up to the delivery team and (above all) the analyst to work it out from the real need behind the requirement. Even so, it is worth knowing what each format is "specialized" in, so you know what to expect from it and... what the quote might look like.

PDF is associated with non-editable documents (although that is debatable too) that look the same in any environment where we open them. They are usually A4, but not always. That makes them great for reports (including ones with charts) and for contracts, statements and forms that are printed and then filled in by hand. PDF is also a good choice when looks matter to us, for example when we want varied text formatting or a company logo and details in the header or footer. It is not suitable for presenting a report as a table with a great many columns, and of course it does not allow dynamic filtering or sorting of the data. Because the format is so popular, there are many libraries for generating PDF documents in various technologies, although it often takes a lot of work to produce exactly the file you need.

When we have a lot of data (for example in a table) and want to filter, sort and copy it afterwards, it makes sense to export to a format that Microsoft Excel or an equivalent program can handle. But the choice of a specific format is not clear-cut here, and it does not always point to XLS or XLSX. Let us consider whether such a report needs, for example, separate sheets (to group tables of data by some criterion) and/or cell formatting. In many cases, if we do not need either (for example several files will do just as well as one file with multiple sheets), XLS is not the right choice and CSV is enough. This is reflected in the quote: creating a file with a typical Excel extension means creating a binary file, which calls for a suitable library. It is not very hard, but there are some inconveniences and problems to deal with, whereas creating a CSV file (a text file with a simple structure) is usually quite easy (leaving aside how the data itself is fetched, which applies to every document type). Such a file can certainly be imported into Excel, and the barrier here may be on the client's side, since people who are complete beginners with spreadsheet software may not manage it. Even so, CSV is usually enough, and unless the file has to be "aesthetically advanced", it is worth considering the cheaper option.

Speaking of text files, sometimes an export to the good old TXT format is enough. It is also simple, and it can be sufficient when we want, for example, a structurally simple but long text that we will then copy into another tool. For instance, a bulleted list of tasks completed in a given period can be pasted into an email to the client. This is especially useful when the information in the system sits in tables or HTML and is hard to copy from the page with the formatting intact.

In many cases, communication between services relies on exchanging data in XML and JSON. On the web the latter prevails because of its smaller size (braces and brackets take fewer characters than XML tags), but the former describes a document better and in theory can do more (something that master's students of computer science at Poznan University of Technology know well, greetings). Sometimes users also want to get these formats "by hand", so they can import them into other tools later. Both formats are text, but here it matters more to keep (and often first to design) the right structure. It is not difficult (XML is somewhat more complex and may need a library, although an export without one is also possible), but the work here also includes defining and implementing the internal structure of the file, such as the hierarchy of nodes, the types of values and so on. Everything depends on what the file will be used for and what goal the people choosing one of these formats have in mind.

Of course, exporting to files with other structures is often an option too (where it makes sense), and so is exporting to external systems, which is possible through an API. It is also worth remembering that systems allow data import, but this is usually harder than export and not always easy to do. File formats vary widely: some have a simple structure and some a complex one, some are text and some binary, some open and some closed... Even so, processing files in applications is possible, and it pays to know the pros and cons of each extension, so you can pick the one that fits your needs and not overpay.

Best regards and thank you, Jakub Rojek.