How to Export iOS Screen Time Data to CSV

Felix Kohlhas • GitHub: [ScreenTime2CSV]
Tags: Data Science Python
A guide on how to export iOS (and iPadOS) screen time data by reading it directly from the knowledgeC.db and exporting it to CSV

As described in my previous blog post on exporting Screen Time data from iOS, the currently only reasonable way of exporting the data is by reading it directly from the knowledgeC.db of a MacOS device. As a simpler alternative to importing the data into InfluxDB I have created a Python script to export the data to a CSV file. You can download it from the ScreenTime2CSV Repository on GitHub.

Enable Sync

  1. Sign in to both devices using the same iCloud account.
  2. On your iOS or iPadOS device, go to Settings > Screen Time.
  3. Enable the “Share across devices” option in the Screen Time settings.
Note: The data from the other devices may not show up immediately due to a possible syncing bug. Don’t be discouraged if the data doesn’t appear right away, as it might still be synced correctly and just not displayed in the Screen Time interface yet.

Export to CSV File

Installation

git clone https://github.com/FelixKohlhas/ScreenTime2CSV
cd ScreenTime2CSV

…or download screentime2csv.py directly.

Usage

python screentime2csv.py -o output.csv

output.csv opened in Numbers
output.csv opened in Numbers

CSV Fields

FieldNoteExample
App NameBundle identifier1'org.chromium.Chromium', 'md.obsidian'
UsageApp usage in seconds
Start TimeUnix timestamp (UTC)
End TimeUnix timestamp (UTC)
Creation TimeUnix timestamp (UTC)
Time ZoneOffset from UTC in seconds3600, 7200
Device IDDevice UUID'9B392A24-F0A5-5BF9-AC20-0CC38404D6CE', 'B9C0C352-91F5-5940-AC26-64BE69B4EC75'
Device ModelDevice Model'iPhone14,2', 'iPad8,5'
The last two fields (device id and device model) are only set if the data is from a remote device, otherwise they are empty.

Comments

This blog does not currently have a comment function. You can send me an email to [email protected] instead and I will add it here.