Implementing Data Export (CSV, Excel) from Mobile Apps

Implementing Data Export (CSV, Excel) from Mobile Apps User taps "Export" — and waits. If there are 5000 rows in a local SQLite or Room database, and export runs on the main thread, the app freezes for seconds, and on older devices an ANR (Application Not Responding) is almost guaranteed. This is

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Implementing Data Export (CSV, Excel) from Mobile Apps
Simple
~2-3 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    894
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    782
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1002
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    597

Implementing Data Export (CSV, Excel) from Mobile Apps

User taps "Export" — and waits. If there are 5000 rows in a local SQLite or Room database, and export runs on the main thread, the app freezes for seconds, and on older devices an ANR (Application Not Responding) is almost guaranteed. This is the first and most common mistake when implementing export. In our practice, we encounter such situations constantly and have developed a reliable approach that guarantees stable operation even on devices with 2 GB of RAM.

Our engineers with seven years of mobile development experience have delivered over 50 projects involving data export. Each project was tested on real data volumes up to 500,000 rows. For example, on a logistics app with 500,000 transaction records, we reduced export time from 15 seconds to 2.1 seconds by using batched writes on a background thread. Contact us — we'll review your architecture in 30 minutes.

Why encoding is a trapCSV is a trap. Excel on Windows expects Windows-1252 encoding and a semicolon `;` as delimiter, not a comma. If you deliver UTF-8 without BOM, Cyrillic becomes garbled. The correct CSV for Excel: UTF-8 with BOM (`\uFEFF` at the start of the file) and semicolon delimiter. Or export directly as `.xlsx` using a library.

Problems we solve in practice

UI freeze during file generation. Serializing 10,000 rows to CSV is not instant. On Android, use CoroutineScope(Dispatchers.IO), on iOS DispatchQueue.global(qos: .userInitiated). We always move file generation to a background thread and return the result via callback or Flow.

Encoding and delimiter. CSV is a trap. Excel on Windows expects Windows-1252 encoding and semicolon ; as delimiter, not a comma. If you deliver UTF-8 without BOM, Cyrillic becomes garbled in the client's office. The correct CSV for Excel: UTF-8 with BOM (\uFEFF) and semicolon delimiter. Or export directly as .xlsx using a library.

Export to Excel (.xlsx). On Android we use Apache POI or the lighter FastExcel. On iOS — xlsxwriter via Swift Package or a custom XML generator (.xlsx is a ZIP of XML files). React Native apps can use react-native-xlsx over the js xlsx library.

How we build the export

The scheme is simple: read data from local DB → transform into row model → write to file → share via system ShareSheet / Intent.ACTION_SEND.

On Android with Room:

viewModelScope.launch(Dispatchers.IO) { val rows = database.transactionDao().getAll() val file = CsvExporter.export(rows, context.cacheDir) withContext(Dispatchers.Main) { shareFile(file, "text/csv") } } 

On iOS similarly via Task.detached:

Task.detached(priority: .userInitiated) { let rows = await store.fetchAll() let url = try CsvExporter.write(rows, to: .cachesDirectory) await MainActor.run { presentShareSheet(url) } } 

For .xlsx on iOS, we generate XML structure manually or via CoreXLSX / xlsxwriter. For simple tables, the XML approach is faster and dependency-free.

Progress for large volumes

If rows exceed 50,000, we show a ProgressView with real percentage. On Android via StateFlow<Int> in ViewModel, on iOS via @Published var progress: Double. We write the file in batches of 1000 rows and update the counter after each batch.

File format and sharing

After generation, we place the file in cacheDir (Android) or FileManager.default.temporaryDirectory (iOS). We share via:

  • Android: FileProvider + Intent.ACTION_SEND with correct MIME type (text/csv or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
  • iOS: UIActivityViewController with [fileURL]

We never save to Downloads without explicit user request — that violates both platform guidelines.

Why background thread export is critical

Any I/O and serialization work must be off the main thread. In practice, this reduces app response time by 5–10 times for exports starting at 10,000 rows. Our engineers verify this on every project.

How to correctly display Cyrillic in CSV for Excel

Use UTF-8 with BOM and semicolon as delimiter. Alternatively, export to .xlsx where encoding is not an issue. We have experience adapting exports for local markets including Cyrillic and Asian characters.

Step-by-step export implementation

  1. Choose format (CSV or XLSX) and agree on column structure.
  2. Read data from DB on a background thread.
  3. Generate file with correct encoding and delimiters.
  4. Show progress for large volumes.
  5. Share via system dialog.

What's included in the work

  • Format selection (CSV / XLSX) and column structure agreement
  • Background file generation without UI blocking
  • Correct encoding and localized delimiters
  • Progress indicator for large exports
  • System ShareSheet / Intent sharing
  • Testing on real data volumes

Timelines

Simple CSV export from an existing database: 0.5–1 day. With format selection (CSV/XLSX), date range filters, and progress: 1.5–2 days. Cost is determined after data structure analysis — we'll assess your project for free. Contact us to discuss your task and get a consultation on format selection and work scope.

Format Implementation Complexity Formatting Support Dependencies
CSV Low No Minimal
XLSX Medium Yes Apache POI / xlsxwriter
Data Volume Recommended Format Approximate Generation Time
< 10,000 CSV or XLSX < 1 second
10,000 – 100,000 XLSX 1–10 seconds
> 100,000 CSV (batched) 10+ seconds, progress needed