File size: 5,008 Bytes
76c86ae
01ba8b4
 
 
76c86ae
 
017c783
76c86ae
 
 
 
 
01ba8b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b7ae0d9
01ba8b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
title: Salesforce Data Loader
emoji: πŸš€
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.20.0
app_file: app.py
pinned: false
license: mit
---

# πŸš€ Salesforce Data Loader

A powerful, user-friendly web application for uploading and downloading data from Salesforce. Built with Gradio and designed for easy bulk data operations.

## ✨ Features

### πŸ” Secure Authentication
- Connect to Salesforce production or sandbox environments
- Secure credential handling with username, password, and security token
- Real-time connection status feedback

### πŸ“€ Data Upload
- **File Support**: Upload CSV and Excel files (.csv, .xlsx, .xls)
- **Bulk Operations**: 
  - **Insert**: Add new records
  - **Update**: Modify existing records  
  - **Upsert**: Insert or update based on external ID
- **Object Support**: Works with common Salesforce objects (Account, Contact, Lead, Opportunity, Case, etc.)
- **Field Mapping**: Automatic field detection and validation
- **Results Tracking**: Download detailed results with success/error reports

### πŸ“₯ Data Export
- Export data from any accessible Salesforce object
- Select specific fields to export
- Configurable record limits (100-10,000 records)
- Download as CSV format
- SOQL query generation

### πŸ›‘οΈ Error Handling
- Comprehensive error reporting
- Field validation and type checking
- Bulk operation result tracking
- Detailed logging for debugging

## πŸš€ How to Use

### 1. Connect to Salesforce
1. Navigate to the **πŸ” Connection** tab
2. Enter your Salesforce credentials:
   - **Username**: Your Salesforce email
   - **Password**: Your Salesforce password
   - **Security Token**: Get this from Salesforce Setup β†’ Personal Information β†’ Reset Security Token
3. Check "Sandbox Environment" if connecting to a sandbox
4. Click "πŸ”— Connect to Salesforce"

### 2. Upload Data
1. Go to the **πŸ“€ Upload Data** tab (appears after successful connection)
2. Upload your CSV or Excel file
3. Select the target Salesforce object
4. Choose operation type:
   - **Insert**: For new records
   - **Update**: For existing records (requires record IDs)
   - **Upsert**: For insert/update based on external ID
5. Click "πŸ“€ Upload Data"
6. Download the results file to see detailed operation results

### 3. Export Data  
1. Go to the **πŸ“₯ Export Data** tab
2. Select the Salesforce object to export
3. Choose specific fields or leave empty for default fields
4. Set the record limit (max 10,000)
5. Click "πŸ“₯ Export Data"
6. Download the exported CSV file

## πŸ“‹ Supported Salesforce Objects

- **Account** - Companies and organizations
- **Contact** - Individual people
- **Lead** - Potential customers
- **Opportunity** - Sales deals
- **Case** - Customer service cases
- **Campaign** - Marketing campaigns
- **User** - Salesforce users
- **Product2** - Products and services

*Note: The application automatically detects which objects you have access to based on your Salesforce permissions.*

## πŸ”§ Technical Requirements

### For Users
- Valid Salesforce credentials (username, password, security token)
- CSV or Excel files for data upload
- Modern web browser

### For Developers
- Python 3.8+
- Required packages (see requirements.txt):
  - gradio==4.32.0
  - simple-salesforce==1.12.6
  - pandas==2.1.4
  - openpyxl==3.1.2
  - xlsxwriter==3.1.9
  - python-dotenv==1.0.0
  - requests==2.31.0
  - numpy==1.24.3

## πŸ”’ Security & Privacy

- **No Data Storage**: Your Salesforce credentials and data are not stored on our servers
- **Secure Connections**: All API calls use HTTPS encryption
- **Session-Based**: Connections are only maintained during your browser session
- **Local Processing**: File processing happens in real-time without permanent storage

## 🚨 Important Notes

1. **Security Token**: If you've never used the security token, reset it in Salesforce Setup
2. **API Limits**: Be mindful of your Salesforce API call limits
3. **Field Mapping**: Ensure your CSV/Excel column names match Salesforce field names
4. **Required Fields**: Make sure all required Salesforce fields are included in your data
5. **Data Validation**: Review your data before upload to avoid errors

## πŸ› οΈ Local Development

To run this application locally:

```bash
# Clone the repository
git clone <your-repo-url>
cd salesforce-data-loader

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py
```

The application will be available at `http://localhost:7860`

## 🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

## πŸ†˜ Support

If you encounter any issues:
1. Check your Salesforce credentials and permissions
2. Verify your security token is current
3. Ensure your data format matches Salesforce field requirements
4. Review the error messages in the results download

---

**Built with ❀️ using Gradio and Simple-Salesforce**