A Python utility for generating printable flashcards from CSV or ODS files with terms and definitions.
Flashcardio transforms terms and definitions into perfectly-aligned double-sided flashcards ready for printing.
Each page contains a grid of terms or definitions. After printing (using the "flip on long edge" option), simply cut along the grid lines to create individual flashcards—each with a term on one side and its definition on the reverse.
- Multiple Input Formats: Process CSV files or ODS spreadsheets (with multiple sheets)
- Double-Sided Printing: Creates alternating pages with terms and mirrored definitions
- Customizable Layout: Configure columns, rows, and margins to fit your needs
- Multiple Topics Support: Each CSV file or ODS sheet becomes a separate section
- Dynamic Text Sizing: Automatically adjusts text to fit within each flashcard cell
-
Clone this repository:
git clone https://github.com/cp2718/Flashcardio.git cd Flashcardio -
Install required dependencies:
pip install -r requirements.txt
Each CSV file should have:
- A header row (will be skipped)
- Two columns: first column for terms, second column for definitions
| Word | Definition |
|---|---|
| acknowledgment | A formal declaration made before an authorized official. |
| contract | A legally binding agreement between two or more parties. |
Each sheet in the ODS file should have:
- A header row: "Word", "Definition"
- 2 columns: first for terms, second for definitions
Each sheet will become a separate section in the PDF.
Check the samples folder for examples of a CSV or ODS file with words and definitions.
Running the script without arguments will display the usage help:
python flashcardio.pyThis will show:
usage: flashcardio.py [-h] [--csv CSV] [--csv_dir CSV_DIR] [--ods ODS] [--output OUTPUT] [--cols COLS] [--rows ROWS] [--margin MARGIN] [csv_file]
Process all CSV files in a directory:
python flashcardio.py --csv_dir csv_files --output flashcards.pdfProcess a single CSV file:
python flashcardio.py --csv samples/sample.csv --output flashcards.pdfProcess an ODS file (each sheet becomes a section):
python flashcardio.py --ods samples/sample.ods --output flashcards.pdfCombine ODS and CSV sources:
python flashcardio.py --ods samples/sample.ods --csv_dir csv_files --output combined.pdf| Option | Description | Default |
|---|---|---|
--csv_dir |
Directory containing CSV files | - |
--csv |
Path to a single CSV file | - |
--ods |
Path to an ODS file | - |
--output |
Output PDF file path | output_table_layout.pdf |
--cols |
Number of columns per page | 3 |
--rows |
Number of rows per page | 3 |
--margin |
Margin size in points (1/72 inch) | 36 |
# Use 4 rows (12 cards per page)
python flashcardio.py --rows 4 --csv_dir csv_files --output rows4.pdf
# Use custom CSV directory
python flashcardio.py --csv_dir my_csv_folder --output custom_dir.pdf
# Change column count
python flashcardio.py --cols 4 --rows 2 --csv samples/sample.csv --output grid4x2.pdf
# Combine multiple options
python flashcardio.py --ods samples/sample.ods --cols 2 --rows 4 --margin 30 --output custom_layout.pdfTo install Flashcardio as a CLI tool:
pip install .This lets you run flashcardio from anywhere instead of python flashcardio.py:
flashcardio --csv samples/sample.csv --output flashcards.pdfTo uninstall:
pip uninstall flashcardio- Print the generated PDF using double-sided printing
- Select the "Flip on long edge" option for proper alignment
- Cut along the grid lines to create individual flashcards
- Each card will have a term on one side and its definition on the reverse
For each CSV file or ODS sheet:
- Title page (CSV filename or sheet name, formatted)
- Words page (batch 1)
- Definitions page (batch 1, mirrored for double-sided printing)
- Words page (batch 2)
- Definitions page (batch 2)
- ... and so on until all terms are processed
- Python 3.9+
- reportlab (
pip install reportlab) - odfpy (
pip install odfpy) — only needed for ODS file support
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! To set up a development environment:
pip install -e .[dev]
pytest tests/Please feel free to submit a Pull Request.