Skip to main content

Overview

PhotoFlow provides CSV import functionality to help you:
  • Migrate existing data from spreadsheets or other systems
  • Bulk operations - Import many tasks at once
  • Data portability - Move data between PhotoFlow instances
CSV export is not yet implemented. For backups, use database backups or manual export methods described in this guide.
CSV (Comma-Separated Values) is a universal format that works with Excel, Google Sheets, and virtually any spreadsheet application.

CSV Import

Import tasks in bulk from a CSV file.

CSV File Format

Your CSV file should follow this structure:
id,task,dueAt,status,additional_information,is_finished,taskColumn
1,"Wedding Photography - Smith Family",2026-03-15,"In Progress","Outdoor ceremony at Grand Hall",false,1
2,"Portrait Session - Johnson",2026-03-20,"Scheduled","Studio session, family of 4",false,1
3,"Event Photography - Corporate Gala",2026-03-25,"Editing","500+ guests, requires fast turnaround",false,2
Column definitions:
ColumnTypeDescriptionExample
idNumberTask ID (can be blank for new tasks)1
taskStringTask name/title”Wedding Photography - Smith”
dueAtDateDue date in ISO format2026-03-15
statusStringCurrent status”In Progress”
additional_informationStringTask description”Outdoor ceremony, 100 guests”
is_finishedBooleanCompletion statusfalse
taskColumnStringColumn/stage ID1
The first row (header row) is automatically skipped during import. Ensure your data starts on row 2.

Import Process

1

Prepare CSV File

Create or export your CSV file following the format above. Ensure:
  • Dates are in YYYY-MM-DD format
  • Boolean values are lowercase: true or false
  • Text with commas is enclosed in quotes
  • File is UTF-8 encoded
2

Access Import Functionality

Navigate to the import page or section in PhotoFlow (typically in settings or task management area).
3

Upload CSV File

Select your CSV file for upload. The application will parse and validate the file.
4

Review and Confirm

Review the tasks to be imported. Confirm when ready.
5

Import Completes

Tasks are created in the database and appear on your Kanban board.

Import API

Import tasks programmatically:
POST /api/importcsv

Request Body:
{
  "file": [
    ["id", "task", "dueAt", "status", "additional_information", "is_finished", "taskColumn"],
    ["1", "Wedding - Smith", "2026-03-15", "In Progress", "Outdoor ceremony", "false", "1"],
    ["2", "Portrait - Johnson", "2026-03-20", "Scheduled", "Family of 4", "false", "1"]
  ]
}

Response:
"Successful!"

API Implementation

The import endpoint is in src/routes/api/(exportimport)/importcsv/+server.ts:
export const POST: RequestHandler = async ({ request }) => {
  try {
    const file = await request.json();
    file.file.shift();  // Remove header row

    const query = file.file.map((item: any) => {
      return {
        dueAt: new Date(item[2]),
        task: item[1],
        additional_information: item[4],
        taskColumn: item[6],
        is_finished: item[5] === 'true' ? true : false,
        status: item[3]
      };
    });

    for (let i = 0; i < query.length; i++) {
      await prisma.tasks.create({
        data: query[i]
      });
    }
    return json('Successful!');
  } catch {
    return json('Invalid!');
  }
};
What the import does:
  1. Removes the header row
  2. Maps CSV columns to task fields
  3. Converts date strings to Date objects
  4. Converts string “true”/“false” to boolean
  5. Creates each task in the database sequentially
The import creates NEW tasks. It does not update existing tasks. If you want to update tasks, you’ll need to delete the old ones first or modify the import logic.

CSV Export

CSV export functionality is currently under development. The export helper functions exist in the codebase (src/lib/utils/db-export-import/export.ts) but are not yet fully implemented with a UI or API endpoint.

Manual Export Alternative

Until the export feature is completed, you can export data manually using Prisma Studio or direct database queries: Using Prisma Studio:
npx prisma studio
Then select the Tasks table and use the export feature built into Prisma Studio. Using PostgreSQL:
# Export tasks to CSV
psql -d photoflow -c "COPY tasks TO '/path/to/tasks.csv' WITH CSV HEADER;"

# Export comments to CSV
psql -d photoflow -c "COPY task_comments TO '/path/to/comments.csv' WITH CSV HEADER;"
Expected Export Format: When export is implemented, it will include all task fields:
id,task,dueAt,status,additional_information,is_finished,taskColumn,created_at,amount_of_comments
1,"Wedding - Smith",2026-03-15T00:00:00.000Z,"In Progress","Outdoor ceremony",false,1,2026-03-01T10:30:00.000Z,3

Use Cases

Initial Setup

Import existing orders from spreadsheets when first deploying PhotoFlow.

Regular Backups

Use database backups or Prisma Studio exports for regular backups.

Reporting

Export data for analysis using Prisma Studio or database queries.

Migration

Move tasks between different PhotoFlow instances or environments.

Archiving

Export and delete old finished tasks to keep the database lean.

Data Integration

Integrate with other systems that accept CSV imports.

Working with CSV Files

Creating CSV Files

In Excel/Google Sheets:
  1. Enter your data in columns matching the required format
  2. File > Save As > Choose “CSV (Comma delimited)”
  3. Ensure UTF-8 encoding if prompted
Programmatically (JavaScript): PhotoFlow uses the PapaParse library for CSV handling:
import Papa from 'papaparse';

// Parse CSV
const parsed = Papa.parse(csvString, {
  header: true,
  dynamicTyping: true
});

// Generate CSV
const csv = Papa.unparse(tasksArray);

Editing CSV Files

Best practices:
  • Use a proper CSV editor or spreadsheet application
  • Don’t edit in basic text editors (easy to break formatting)
  • Keep quotes around text with commas or special characters
  • Use ISO date format (YYYY-MM-DD) for consistency
  • Don’t include formulas - export values only

Special Characters

Handle special characters properly:
task,description
"Wedding with ""quotes""","Ceremony, reception, and dancing"
"Line break","First line
Second line"
  • Quotes inside quoted fields: Use double quotes ("")
  • Commas in values: Enclose the entire value in quotes
  • Line breaks: Enclose in quotes (though not recommended)

Bulk Operations

Import Large Datasets

For importing hundreds or thousands of tasks:
1

Prepare Data

Clean and validate your CSV file:
  • Remove duplicate entries
  • Ensure all dates are valid
  • Verify column IDs exist
  • Check for missing required fields
2

Test with Small Sample

Import a few rows first to verify format is correct.
3

Import in Batches

If possible, import in chunks of 100-500 rows to avoid timeouts.
4

Verify Results

Check the Kanban board and database to ensure all tasks imported correctly.
Large imports may take several minutes. Don’t refresh the page or close the browser during import.

Performance Considerations

The current implementation imports tasks sequentially:
for (let i = 0; i < query.length; i++) {
  await prisma.tasks.create({ data: query[i] });
}
For better performance with large imports, consider:
  • Using prisma.tasks.createMany() for batch inserts
  • Processing in parallel with Promise.all()
  • Implementing progress tracking
  • Adding validation before import

Data Validation

Required Fields

Ensure your CSV includes:
  • task - Task name (required)
  • dueAt - Due date (required)
  • status - Status string
  • taskColumn - Valid column ID

Date Validation

Dates must be in a format that JavaScript’s new Date() can parse: Valid formats:
2026-03-15
2026-03-15T10:30:00
2026-03-15T10:30:00.000Z
03/15/2026  (but ISO format is preferred)
Invalid formats:
15-03-2026
15/03/2026
March 15, 2026

Column Validation

Ensure taskColumn values match your board configuration. Invalid column IDs will cause tasks to not appear correctly.

Error Handling

If import fails:
The catch block returns “Invalid!” for any error. Common causes:
  • Malformed CSV structure
  • Invalid date formats
  • Missing required fields
  • Database connection issues
Check server logs for detailed error messages.
If some tasks import but others fail:
  • The current implementation doesn’t use transactions
  • Successfully imported tasks remain in database
  • Failed tasks are skipped
  • Review the CSV for issues in failed rows
Running the same import twice creates duplicate tasks. To avoid:
  • Export current tasks first
  • Compare IDs
  • Delete duplicates manually if needed

Backup Strategy

Since CSV export is not yet implemented, use database backups:
1

Regular Database Backups

Schedule regular PostgreSQL backups (weekly or monthly):
# Example backup script
pg_dump photoflow > backup_$(date +%Y%m%d).sql
2

Store Securely

Save backups in multiple locations:
  • Local server storage
  • Network attached storage
  • Cloud storage (encrypted)
  • External hard drive
3

Test Restoration

Periodically test restoring backups to ensure they’re valid.
4

Keep Multiple Versions

Retain backups from multiple time periods (daily, weekly, monthly).
See Production Checklist for comprehensive backup best practices.

Troubleshooting

  1. Check browser console for errors
  2. Verify CSV format matches expected structure
  3. Review server logs for detailed error messages
  4. Test with a minimal CSV (1-2 rows)
  1. Use ISO format: YYYY-MM-DD
  2. Check timezone handling
  3. Ensure dates are valid (no Feb 30th, etc.)
  1. Ensure CSV is UTF-8 encoded
  2. Check for BOM (Byte Order Mark) issues
  3. Test with ASCII-only characters first
  1. Verify taskColumn values are valid
  2. Check if tasks are marked is_finished: true
  3. Refresh the browser
  4. Check database directly with Prisma Studio

Next Steps

Task Management

Learn about managing tasks after import

Database Setup

Understand the database schema

Production Checklist

Backup strategies and best practices

Kanban Board

View and manage imported tasks

Build docs developers (and LLMs) love