https://github.com/hunkim/img2excel
https://github.com/hunkim/img2excel
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hunkim/img2excel
- Owner: hunkim
- Created: 2025-06-14T20:08:43.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-06-17T17:35:13.000Z (7 months ago)
- Last Synced: 2025-06-25T05:11:35.592Z (7 months ago)
- Language: TypeScript
- Homepage: https://img2excel-omega.vercel.app
- Size: 10.8 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# img2excel - AI-Powered Image to Spreadsheet Converter
**Never Manually Type Data Again.** Turn any image with data into an editable spreadsheet instantly using AI.
[](https://github.com/hunkim/img2excel)
[](LICENSE)
[](https://www.upstage.ai/)
## โจ Features
- ๐ค **AI-Powered**: Uses [Upstage AI](https://console.upstage.ai/docs/capabilities/information-extraction/universal-information-extraction) for intelligent schema generation and data extraction
- ๐ธ **Smart Schema Detection**: Automatically detects data structure from your first image
- ๐ **Adaptive Extraction**: Uses your custom column headers as schema for subsequent images
- ๐ **Real-time Editing**: Edit extracted data in a spreadsheet interface
- ๐พ **Project Management**: Save and manage multiple projects with Firebase
- ๐ **Authentication**: Google Sign-in for project persistence
- ๐ฑ **Responsive Design**: Works on desktop and mobile
- ๐ฏ **Multiple Formats**: Supports receipts, tables, invoices, lists, and more
- ๐ **CSV Export**: Download your data as CSV files
- ๐ **Issue Reporting**: Built-in GitHub issue reporting
## ๐๏ธ Architecture Overview
```mermaid
graph TB
subgraph "Frontend (Next.js 15)"
A[Landing Page] --> B[Image Upload]
B --> C[Editor Page]
C --> D[Spreadsheet Interface]
D --> E[CSV Export]
end
subgraph "State Management"
F[Zustand Store] --> G[Project State]
F --> H[Image Columns]
F --> I[Schema Keys]
end
subgraph "Backend Services"
J[Upstage AI] --> K[Schema Generation]
J --> L[Information Extraction]
M[Firebase] --> N[Authentication]
M --> O[Firestore DB]
M --> P[Storage]
end
C --> F
B --> J
C --> M
style A fill:#e1f5fe
style C fill:#e8f5e8
style J fill:#fff3e0
style M fill:#fce4ec
```
## ๐ Business Logic Flow
```mermaid
sequenceDiagram
participant U as User
participant UI as Frontend
participant S as Store
participant AI as Upstage AI
participant FB as Firebase
U->>UI: Upload First Image
UI->>S: addImageColumn(file, userId?)
S->>AI: Generate Schema
AI-->>S: Schema Fields
S->>AI: Generate Title
AI-->>S: Meaningful Title
alt User Logged In
S->>FB: Save Project Template
FB-->>S: Project ID
end
S->>AI: Extract Information
AI-->>S: Extracted Data
S->>UI: Update Spreadsheet
U->>UI: Upload Additional Images
UI->>S: addImageColumn(file, userId?)
S->>AI: Extract with Existing Schema
AI-->>S: Extracted Data
alt User Logged In
S->>FB: Update Project
end
U->>UI: Export CSV
UI->>U: Download File
```
## ๐ Quick Start
### Prerequisites
- Node.js 18+ and npm/pnpm
- [Upstage AI API Key](https://console.upstage.ai/)
- [Firebase Project](https://console.firebase.google.com/) (optional, for project persistence)
### Installation
1. **Clone and Install**:
```bash
git clone https://github.com/hunkim/img2excel.git
cd img2excel
npm install --legacy-peer-deps
```
2. **Configure Environment**:
Create `.env.local` in the root directory:
```env
# Required: Upstage AI API Key
UPSTAGE_API_KEY=your_upstage_api_key_here
# Optional: Firebase Configuration (for project persistence)
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=123456789
NEXT_PUBLIC_FIREBASE_APP_ID=1:123456789:web:abcdef
# Optional: Rate Limiting Configuration
ANONYMOUS_RATE_LIMIT=60 # Requests per hour for non-logged users
AUTHENTICATED_RATE_LIMIT=240 # Requests per hour for logged users
RATE_LIMIT_WINDOW_MS=3600000 # Time window in milliseconds (1 hour)
```
3. **Run Development Server**:
```bash
npm run dev
```
4. **Open Application**:
Visit `http://localhost:3000`
## ๐ Usage Examples
### ๐ Receipt Processing
1. Upload a receipt image
2. AI detects: "Item Name", "Price", "Category"
3. Add more receipts - they follow the same schema
4. Export to CSV for expense tracking
### ๐งพ Invoice Processing
1. Upload an invoice
2. AI detects: "Description", "Quantity", "Unit Price", "Total"
3. Process multiple invoices consistently
4. Export for accounting
### ๐ Table Digitization
1. Upload a photo of a table/list
2. AI detects column structure
3. Add similar tables with consistent extraction
4. Export structured data
## ๐ง API Integration
### Schema Generation API
```typescript
POST /api/schema-generation
Content-Type: application/json
{
"imageUrl": "data:image/jpeg;base64,..."
}
```
### Information Extraction API
```typescript
POST /api/information-extraction
Content-Type: application/json
{
"imageUrl": "data:image/jpeg;base64,...",
"schema": {
"type": "object",
"properties": {
"field_name": {
"type": "string",
"description": "Field description"
}
}
}
}
```
### Schema Naming API
```typescript
POST /api/schema-naming
Content-Type: application/json
{
"fieldNames": ["field1", "field2", "field3"]
}
```
## ๐๏ธ Tech Stack
- **Framework**: Next.js 15 with React 19
- **Language**: TypeScript
- **Styling**: Tailwind CSS + shadcn/ui
- **State Management**: Zustand
- **Authentication**: Firebase Auth
- **Database**: Firestore
- **Storage**: Firebase Storage
- **AI Service**: Upstage AI Agentic Information Extraction
- **Deployment**: Vercel
## ๐ Project Structure
```
โโโ app/
โ โโโ api/ # API routes
โ โ โโโ schema-generation/ # AI schema generation
โ โ โโโ information-extraction/ # AI data extraction
โ โ โโโ schema-naming/ # AI title generation
โ โโโ editor/ # Spreadsheet editor page
โ โโโ globals.css # Global styles
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Landing page
โโโ components/
โ โโโ ui/ # shadcn/ui components
โ โโโ auth-button.tsx # Authentication component
โ โโโ image-uploader.tsx # Drag & drop upload
โ โโโ projects-sidebar.tsx # Project management
โ โโโ ... # Other components
โโโ lib/
โ โโโ firebase-service.ts # Firebase operations
โ โโโ upstage-service.ts # AI API integration
โ โโโ utils.ts # Utility functions
โโโ store/
โ โโโ spreadsheet-store.ts # Zustand state management
โโโ hooks/
โ โโโ useAuth.ts # Authentication hook
โโโ public/ # Static assets
```
## ๐ v0.3 Improvements
### ๐ฑ Mobile-First Responsive Design
- โ
**Complete Mobile Optimization**: Fully responsive design while preserving desktop experience
- โ
**Touch-Friendly Interface**: Proper touch targets and mobile interactions throughout
- โ
**Smart Sidebar Behavior**: Closed by default on mobile, auto-opens on desktop with projects
- โ
**Adaptive Layouts**: Responsive sizing for all components (thumbnails, tables, forms)
- โ
**Enhanced Typography**: Custom breakpoints with scaled text for optimal mobile readability
- โ
**Performance Optimizations**: Touch manipulation CSS and efficient mobile rendering
### ๐ฏ Mobile UX Improvements
- โ
**Overlay Interactions**: Tap outside to close sidebars on mobile
- โ
**Condensed UI**: Hidden non-essential elements on small screens
- โ
**Better Spacing**: Optimized padding and margins for touch interfaces
- โ
**Responsive Icons**: Appropriately scaled icon sizes across breakpoints
- โ
**Mobile-First Table**: Horizontal scrolling with touch-friendly cells
- โ
**Progressive Enhancement**: Graceful scaling from mobile (320px) to desktop
## ๐ v0.2 Improvements
### DRY (Don't Repeat Yourself) Refactoring
- โ
**Eliminated Redundancy**: Removed 200+ lines of duplicate code
- โ
**Unified Image Processing**: Single flow for all image uploads
- โ
**Consolidated Save Logic**: 3 Firebase functions โ 1 `saveProject` function
- โ
**Simplified Authentication**: Clear pattern (logged in = save, not logged in = local only)
### Code Quality Improvements
- โ
**Clean Logging**: 80% reduction in verbose console output
- โ
**Better Error Handling**: Essential error logging preserved
- โ
**Single Responsibility**: Each function has one clear purpose
- โ
**Production Ready**: No sensitive data in logs
### User Experience Enhancements
- โ
**Report Issues**: Bug report icons linking to GitHub
- โ
**Consistent Behavior**: Same upload flow everywhere
- โ
**Better Performance**: Reduced string processing and console I/O
## ๐ Environment Variables
| Variable | Description | Required | Default |
|----------|-------------|----------|---------|
| `UPSTAGE_API_KEY` | Your Upstage AI API key | โ
| - |
| `ANONYMOUS_RATE_LIMIT` | Rate limit for non-logged in users (requests/hour) | โ | 60 |
| `AUTHENTICATED_RATE_LIMIT` | Rate limit for logged in users (requests/hour) | โ | 240 |
| `RATE_LIMIT_WINDOW_MS` | Rate limit time window in milliseconds | โ | 3600000 |
| `NEXT_PUBLIC_FIREBASE_API_KEY` | Firebase API key | โ ๏ธ Optional* |
| `NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN` | Firebase auth domain | โ ๏ธ Optional* |
| `NEXT_PUBLIC_FIREBASE_PROJECT_ID` | Firebase project ID | โ ๏ธ Optional* |
| `NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET` | Firebase storage bucket | โ ๏ธ Optional* |
| `NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID` | Firebase messaging sender ID | โ ๏ธ Optional* |
| `NEXT_PUBLIC_FIREBASE_APP_ID` | Firebase app ID | โ ๏ธ Optional* |
*Firebase variables are optional. Without them, the app works in local-only mode (no project persistence).
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Test thoroughly
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to the branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request
### ๐ Reporting Issues
Found a bug or have a feature request? Please use the built-in issue reporting button in the app header, or visit our [GitHub Issues](https://github.com/hunkim/img2excel/issues) page.
## ๐ License
MIT License - feel free to use for personal or commercial projects.
## ๐ Acknowledgments
- **[Upstage AI](https://www.upstage.ai/)** - For providing the powerful Agentic Information Extraction API
- **[Vercel](https://vercel.com/)** - For seamless deployment and hosting
- **[Firebase](https://firebase.google.com/)** - For authentication and data storage
- **[shadcn/ui](https://ui.shadcn.com/)** - For beautiful, accessible UI components
---
**Built with โค๏ธ for productivity** | [Report Issues](https://github.com/hunkim/img2excel/issues) | [Documentation](https://github.com/hunkim/img2excel)