3.3 KiB
3.3 KiB
Quick Start Guide: SharePoint Integration & Scheduling
This guide will help you quickly set up SharePoint integration and automated report generation.
Quick Setup (5 minutes)
1. Install Dependencies
pip install -r requirements.txt
2. Create Configuration
cp config.yaml.template config.yaml
3. Configure SharePoint
Edit config.yaml:
sharepoint:
enabled: true
site_url: "https://yourcompany.sharepoint.com/sites/YourSite"
folder_path: "/Shared Documents/Reports" # Path to your Excel files
use_app_authentication: true
client_id: "your-azure-ad-client-id"
client_secret: "your-azure-ad-client-secret"
To get Azure AD credentials:
- Go to Azure Portal → App registrations
- Create new registration or use existing
- Create a client secret
- Grant SharePoint API permissions:
Sites.Read.All - Copy Client ID and Client Secret to config
4. Choose Your Deployment Method
Option A: Scheduled Reports (Recommended)
Edit config.yaml:
scheduler:
enabled: true
schedule_type: "cron"
cron_expression: "0 8 * * *" # 8 AM daily
timezone: "America/New_York"
Start scheduler:
python scheduler.py
Option B: On-Demand via API
Edit config.yaml:
api:
enabled: true
port: 8080
api_key: "your-secret-key" # Optional but recommended
Start API server:
python api_server.py
Generate report:
curl -X POST http://localhost:8080/api/generate \
-H "X-API-Key: your-secret-key" \
-H "Content-Type: application/json \
-d '{"download_from_sharepoint": true}'
How It Works
- SharePoint Download: Downloads latest Excel files from SharePoint folder
- Report Generation: Processes Excel files and generates reports
- Output: Creates
output/report.jsonandoutput/report.html
Testing
Test SharePoint Connection
python sharepoint_downloader.py
This will download files from SharePoint to the reports/ directory.
Test Report Generation
python report_generator.py
This will generate reports from files in the reports/ directory.
Deployment Options
As a Service (Linux)
# Create systemd service
sudo nano /etc/systemd/system/vendor-report.service
# Add:
[Unit]
Description=Vendor Report Scheduler
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/vendor_report
ExecStart=/usr/bin/python3 /path/to/vendor_report/scheduler.py
Restart=always
[Install]
WantedBy=multi-user.target
# Enable and start
sudo systemctl enable vendor-report
sudo systemctl start vendor-report
Docker (Coming Soon)
The application can be containerized for easy deployment.
Troubleshooting
SharePoint Authentication Fails
- Verify Azure AD app has correct permissions
- Check client ID and secret are correct
- Ensure SharePoint site URL is correct (include
/sites/SiteName)
Files Not Downloading
- Check folder path is correct (use SharePoint's "Copy path" feature)
- Verify app has read permissions
- Check file pattern matches your Excel files
Scheduler Not Running
- Check timezone is correct
- Verify cron expression format
- Check logs for errors
Next Steps
- Set up monitoring/alerting for failed reports
- Configure webhook notifications
- Set up automated email delivery of reports
- Integrate with other systems via API