Skip to content

Add Import/Export support (Anki, CSV) #288

@nicholaspsmith

Description

@nicholaspsmith

Summary

Enable users to import existing flashcards from other systems and export their data for backup or migration.

Motivation

  • Users have existing study material in other apps
  • Anki is the most popular flashcard app with large user base
  • Data portability builds user trust
  • Export enables backup and sharing

Import Formats

Anki (.apkg)

  • SQLite-based format containing cards, decks, media
  • Most common import request
  • Preserve review history if possible

CSV/TSV

  • Simple format: question,answer,tags
  • Common for bulk import from spreadsheets
  • Support custom column mapping

Markdown

  • Q/A pairs in markdown format
  • Natural for technical content
  • ## Question
    What is a pod in Kubernetes?
    
    ## Answer
    The smallest deployable unit...
    

Export Formats

CSV

  • Simple export: question, answer, tags, mastery%
  • Review history optional

Anki (.apkg)

  • Full compatibility with Anki desktop
  • Include scheduling data

JSON

  • Full data export for backup
  • All metadata preserved

Technical Implementation

Anki Import

// Use sql.js to read SQLite in browser
import initSqlJs from 'sql.js'

async function parseAnkiPackage(file: File) {
  const SQL = await initSqlJs()
  const buffer = await file.arrayBuffer()
  const db = new SQL.Database(new Uint8Array(buffer))
  
  const cards = db.exec('SELECT id, flds FROM notes')
  // Parse fields and create flashcards
}

CSV Import

  • Papa Parse for CSV parsing
  • Column mapping UI
  • Preview before import

Import Flow

  1. Upload file
  2. Parse and preview cards
  3. Map to goal/skill tree node
  4. Confirm import
  5. Create flashcards in batches

UI Components

  • Import wizard with step-by-step flow
  • Format detection or selection
  • Preview imported cards
  • Progress indicator for large imports
  • Export button in settings/goal pages

Acceptance Criteria

  • Import Anki .apkg files
  • Import CSV with column mapping
  • Export to CSV format
  • Export to Anki format
  • Preview before importing
  • Handle large files (1000+ cards)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions