This project automates the processing and routing of uploaded CSV files using the Dropbox API.
It detects files, cleans/transforms data when needed, and moves them to the correct destination folder.
- Connects to Dropbox using the Dropbox API.
- Detects new uploaded files in a configured folder.
- Identifies each file by its prefix (example:
CUST,ORD,INV). - Transforms CSV data:
- Removes extra spaces / double quotes.
- Validates and formats dates.
- Fixes invalid phone numbers.
- Generates cleaned CSV files (
orders.csv,invoices.csv,customers.csv). - Uploads the processed file into the correct destination folder.
- Deletes the original file from Dropbox once processed.
flowchart LR
A[User uploads CSV to Dropbox] --> B[List and detect new files]
B --> C{Identify file type by prefix<br/><code>CUST</code> / <code>ORD</code> / <code>INV</code>}
C -->|Customer file| D[Clean + transform CSV\n Remove extra spaces / fix invalid dates / normalize phone numbers]
C -->|Order file| E[Apply order transformation rules\n generate External ID]
C -->|Invoice file| F[Apply invoice transformation rules]
D --> G[Upload cleaned CSV to destination folder]
E --> G
F --> G
G --> H[Delete original file from Dropbox]
/ruby_dropbox_file_automation
│── helpers/
│ ├── constants.rb # File mappings and CSV headers
│── main.rb # Main logic that processes files
│── scheduled_worker.rb # Background execution (cron-style)
│── config.yml.example # Editable configuration template
└── README.md
| Component | Technology |
|---|---|
| Language | Ruby |
| Integration | Dropbox API |
| File processing | CSV |
| Scheduling | Cron worker |
| Config | YAML |
Create your own configuration file from the template:
cp config.yml.example config.ymlThen edit config.yml to set:
- API keys
- Folder paths
- Cron settings (if scheduled)
ruby main.rbOr, if using the scheduled worker:
ruby scheduled_worker.rbThis automation avoids manual handling of files uploaded to Dropbox.
It ensures that CSVs are standardized, validated, and routed to their correct destination automatically.
If you have questions or want to collaborate:
ivan.rivas00@gmail.com