A full-featured web-based spreadsheet application built with ASP.NET Core and SocialCalc JavaScript library. Supports Excel import/export, multi-sheet workbooks, formulas, and collaborative features.
- Features
- Prerequisites
- Installation
- Configuration
- Database Setup
- PHP Setup (Excel Import/Export)
- Running the Application
- Project Structure
- API Endpoints
- Troubleshooting
- Contributing
- π Full Spreadsheet Functionality - Cell editing, formulas, formatting
- π Multi-Sheet Workbooks - Create and manage multiple sheets
- π₯ Import/Export - Support for Excel (.xlsx), CSV, ODS, HTML, PDF
- πΎ Auto-Save - Automatic saving with debounced commits
- π User Authentication - Register, login, password reset
- π± Responsive Design - Works on desktop and mobile
Before you begin, ensure you have the following installed:
| Software | Version | Download |
|---|---|---|
| .NET SDK | 10.0+ | Download |
| SQL Server | LocalDB or Express | Download |
| PHP | 8.0+ | Download |
| Composer | Latest | Download |
| Git | Latest | Download |
dotnet --version # Should show 10.0.x or higher
php -v # Should show PHP 8.x
composer -V # Should show Composer versiongit clone https://github.com/YOUR_USERNAME/Social-Calc.git
cd Social-Calcdotnet restorecd excelinterop
composer install
cd ..Copy the template configuration and update with your settings:
# Windows (PowerShell)
Copy-Item appsettings.template.json appsettings.json
# Linux/Mac
cp appsettings.template.json appsettings.jsonEdit appsettings.json with your specific settings:
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=social_calc;Trusted_Connection=true;"
}Connection String Examples:
| Database Type | Connection String |
|---|---|
| LocalDB | Server=(localdb)\MSSQLLocalDB;Database=social_calc;Trusted_Connection=true; |
| SQL Server Express | Server=.\SQLEXPRESS;Database=social_calc;Trusted_Connection=true; |
| SQL Server (Auth) | Server=your-server;Database=social_calc;User Id=sa;Password=YOUR_PASSWORD;TrustServerCertificate=true; |
Generate secure random keys for production:
"AppSettings": {
"SecretKey": "YOUR_32_CHARACTER_RANDOM_KEY_HERE",
"JwtSecret": "YOUR_64_CHARACTER_RANDOM_JWT_SECRET"
}Generate secure keys (PowerShell):
# 32-character key
-join ((65..90) + (97..122) + (48..57) | Get-Random -Count 32 | ForEach-Object {[char]$_})
# 64-character key
-join ((65..90) + (97..122) + (48..57) | Get-Random -Count 64 | ForEach-Object {[char]$_})"AppSettings": {
"UsePhpCli": true,
"PhpCliPath": "php",
"PhpScriptsDir": "excelinterop",
"PhpTempDir": "excelinterop/tmp"
}Note: Use absolute paths if PHP is not in your system PATH.
"Email": {
"From": "noreply@yourdomain.com",
"SmtpServer": "smtp.gmail.com",
"SmtpPort": 587,
"UseCredentials": true,
"Username": "your-email@gmail.com",
"Password": "your-app-password"
}# Apply migrations to create database schema
dotnet ef database updateIf migrations don't exist, create the database manually:
-- Connect to SQL Server and run:
CREATE DATABASE social_calc;Then run the application - Entity Framework will create tables automatically.
# Check if database exists (SQL Server)
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "SELECT name FROM sys.databases WHERE name = 'social_calc'"PHP is required for Excel, CSV, ODS, HTML, and PDF import/export functionality.
Windows:
- Download PHP from windows.php.net
- Extract to
C:\php - Add
C:\phpto your system PATH - Enable extensions in
php.ini:extension=zip,extension=gd,extension=mbstring,extension=xml
Linux (Ubuntu/Debian):
sudo apt update
sudo apt install php php-cli php-xml php-zip php-gd php-mbstringmacOS:
brew install phpcd excelinterop
composer installThis installs:
- PhpSpreadsheet (Excel read/write)
- TCPDF (PDF export)
# Test PHP
php -v
# Test export functionality
echo '{"numsheets":1,"currentid":"sheet1","sheetArr":{"sheet1":{"sheetstr":{"savestr":"version:1.5\ncell:A1:t:Test\n"},"name":"Sheet1"}}}' > test.json
php excelinterop/export.php test.json output.xlsx Xlsxmkdir -p excelinterop/tmpdotnet runThe application will start at: http://localhost:5000
dotnet run --configuration Release- Open
SocialCalc.Web.csprojin Visual Studio - Press
F5to run with debugging
SocialCalc-Website/
βββ Controllers/ # MVC Controllers
β βββ AuthController.cs # Authentication (login, register, password reset)
β βββ HomeController.cs # Home page, dashboard
β βββ SheetsController.cs # Spreadsheet CRUD, import/export
βββ Data/ # Database context
βββ excelinterop/ # PHP scripts for Excel processing
β βββ export.php # Export to xlsx, csv, ods, html, pdf
β βββ import.php # Import from Excel files
β βββ vendor/ # Composer dependencies (gitignored)
β βββ tmp/ # Temporary files (gitignored)
βββ Migrations/ # EF Core migrations
βββ Models/ # Data models (User, Sheet)
βββ Services/ # Business logic services
βββ Views/ # Razor views
βββ wwwroot/ # Static files (JS, CSS, images)
β βββ js/ # SocialCalc JavaScript libraries
β βββ css/ # Stylesheets
βββ appsettings.json # Configuration (gitignored - create from template)
βββ appsettings.template.json # Configuration template (committed)
βββ Program.cs # Application entry point
| Method | Endpoint | Description |
|---|---|---|
| GET | /login |
Login page |
| POST | /login |
Authenticate user |
| GET | /register |
Registration page |
| POST | /register |
Create new account |
| POST | /logout |
Logout user |
| GET | /lostpw |
Password reset page |
| Method | Endpoint | Description |
|---|---|---|
| GET | /Sheets |
List user's sheets |
| GET | /Sheets/Edit/{id} |
Open sheet editor |
| POST | /Sheets/Save/{id} |
Save sheet data |
| POST | /Sheets/Create |
Create new sheet |
| POST | /Sheets/Delete/{id} |
Delete sheet |
| Method | Endpoint | Description |
|---|---|---|
| POST | /Sheets/Import |
Import Excel/CSV file |
| GET | /Sheets/Export/{id} |
Export to Excel (.xlsx) |
| GET | /Sheets/Export-Csv/{id} |
Export to CSV |
| GET | /Sheets/Export-Format/{id}/{format} |
Export to ods, html |
| GET | /Sheets/Export-Pdf/{id} |
Export to PDF |
Error: Cannot open database "social_calc" requested by the login
Solution: Create the database first:
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "CREATE DATABASE social_calc"
dotnet ef database updateError: Failed to start PHP process for export
Solution:
- Install PHP 8.0+
- Add PHP to system PATH
- Or use absolute path in
appsettings.json:
"PhpCliPath": "C:\\php\\php.exe"Error: JSON decode error
Solution: Ensure the sheet has been saved at least once before exporting. Click the Save button before exporting.
Error: Class 'PhpOffice\PhpSpreadsheet\Spreadsheet' not found
Solution:
cd excelinterop
composer installError: No writer found for type Pdf
Solution: Install TCPDF:
cd excelinterop
composer require tecnickcom/tcpdf- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- SocialCalc - JavaScript spreadsheet engine
- PhpSpreadsheet - PHP Excel library
- ASP.NET Core - Web framework
- TCPDF - PDF generation library