Welcome! This guide will help you get started with the LabFolder Backup Tool in just a few minutes.
This tool is specifically designed for LMU Medical Faculty's LabFolder instance. Other institutions may need to modify the code based on their API configuration.
Use at your own risk. Always verify the completeness and accuracy of your backups. This tool is provided as-is without any warranties.
Before you begin, you'll need:
- Google Chrome browser (other browsers may work but are untested)
- LabFolder account credentials (username and password)
- Basic familiarity with your operating system's file system
- Download the file named
.env.examplein the tool directory (https://raw.githubusercontent.com/jiehua1995/LabFolder_Backup/refs/heads/main/.env.example) - Make a copy and rename it to
.env(remove the.examplepart) - Open
.envin a text editor - Update the following fields with your credentials:
LABFOLDER_USERNAME=your_username LABFOLDER_PASSWORD=your_password DOWNLOAD_DIR=./Download
- Leave all other settings unchanged unless you have specific requirements
- Save the file
.env file private! Never share it.
Recommended for non-technical users
- β Google Chrome installed
- β Windows 10 or 11
- β
.envfile configured (see above)
- Download the executable file:
- Place the executable in a folder where you want to store backups
- Ensure your
.envfile is in the same directory as the executable - Double-click the executable file to run it
- Follow the GUI instructions, including clicking the "Run Backup" button to start the backup process.
- Sit back and let it work! β
The tool will create a folder named as what you specified in the DOWNLOAD_DIR.
For users comfortable with command-line interfaces
- β Python 3.10 or higher installed
- β Google Chrome installed
- β
.envfile configured (see above)
-
Create a virtual environment (recommended):
conda create -n labfolder_backup python=3.10 conda activate labfolder_backup
-
Install required packages:
pip install -r requirements.txt
-
Run the backup script:
Command-line version (detailed output):
python labfolder_backup_v4.py
OR
GUI version (graphical interface with buttons):
python labfolder_gui.py
The backup tool performs 8 major steps. Here's what happens at each stage:
- Authenticates with your LabFolder instance
- Verifies your credentials
- Expected output:
β Login successful
- Retrieves list of all projects and entries
- Queries the LabFolder API
- Expected output: Number of projects and entries found
β οΈ BROWSER WINDOW ALERT: A Chrome window will open automatically- Extracts authentication token for API access
- Duration: ~30 seconds
β οΈ IMPORTANT:- DO NOT click or interact with the browser window
- MOVE your mouse outside the browser window
- Let the automation complete on its own
- Downloads all content from each entry:
- π Text blocks (HTML content)
- πΌοΈ Images (original + annotated versions)
- π Files (attachments)
- π Tables (JSON data)
- π§ͺ Well Plates (JSON data)
- π Data elements
- βοΈ Sketches
- Expected output: Progress bar showing download status
β οΈ BROWSER WINDOW ALERT: A new Chrome window will open- Automates browser to download Excel files for tables and wellplates
- Uses smart scrolling to reveal download buttons
- Duration: ~30 seconds per file
β οΈ IMPORTANT:- DO NOT move your mouse into the browser window
- DO NOT click anything
- MOVE your mouse to:
- Another monitor (if available)
- Outside the browser boundaries
- The browser's title bar (safe zone)
- The script will display: "π Starting in 3 seconds..." before launching
- Expected output: Progress bar showing XLSX downloads
- Creates HTML pages for each entry
- Embeds text, pictures and files directly in HTML
- Generates main index page with project grouping
- Expected output: "β Created X entry HTML pages"
- Creates RO-Crate compliant ELN packages
- Calculates SHA256 hashes for file integrity
- Packages each entry as a
.elnfile - Expected output: "β Created X ELN packages"
- Cleans up temporary files
- Calculates final statistics
- Verifies backup integrity
- Displays comprehensive summary
- Shows total backup size and location
- Provides next steps
labfolder_backup/
βββ Project_Name_1/
β βββ 12345_Entry_Title/
β β βββ index.html (View this in browser!)
β β βββ image_001.png
β β βββ file_attachment.pdf
β β βββ table_123.json
β β βββ table_123_..._Table.xlsx
β βββ 67890_Another_Entry/
β βββ ...
βββ Project_Name_2/
β βββ ...
βββ eln_export/
β βββ 12345_Entry_Title.eln (RO-Crate format)
β βββ 67890_Another_Entry.eln
βββ index.html (β START HERE!)
-
View your backup:
- Open
labfolder_backup/index.htmlin any web browser - Browse through your entries with a beautiful interface
- All tables and wellplates are embedded and viewable
- Open
-
Verify completeness:
- Check that all entries are present
- Verify XLSX files downloaded correctly
- Look for any warning messages in the output
-
Archive for long-term storage:
- Copy the entire
labfolder_backupfolder to external storage - Consider creating a ZIP archive
- Store in multiple locations for redundancy
- Copy the entire
-
ELN files:
- Find your
.elnfiles inlabfolder_backup/eln_export/ - These can be imported into other ELN systems
- Each file is RO-Crate compliant
- Find your
Adjusting Scroll Offset (If Buttons Are Hidden)
If you notice that download buttons are obscured during XLSX downloads:
- Open your
.envfile - Modify this line:
SCROLL_NUDGE_PIXELS=150
- Try different values (120, 150, 200) until buttons appear correctly. The resolution of your screen could affect this. I only tested on 1920x1080.
To change where backups are saved:
- Open
.env - Modify:
DOWNLOAD_DIR=./customized_name
If you want to build the executable file on your own machine:
- Ensure you have PyInstaller installed:
pip install pyinstaller
- Run PyInstaller to create the executable:
pyinstaller labfolder_gui.py --onefile --name "LabFolder Archive" --icon image.ico --add-data "labfolder_backup_v4.py;."
You can then find the executable in the dist folder created by PyInstaller. Your can also change the image.ico to your own icon file if desired.
- β
Verify your credentials in
.env - β Check that your LabFolder instance URL is correct (only supported for LMU Medical Faculty. do not change it.)
- β Ensure you can log in manually via web browser
- β Update Chrome to the latest version
- β Ensure you're not interacting with the browser during automation
- β
Try increasing
SCROLL_NUDGE_PIXELSif buttons are hidden
- β Check the console output for specific error messages
- β Some entries may not have downloadable tables
- β Verify that the failed downloads are noted in the summary
- β
Reinstall requirements:
pip install -r requirements.txt - β Ensure you're using the virtual environment
This tool is provided βas isβ without any warranty of any kind, express or implied. The author, lab, and LMU Munich are not responsible for any data loss, system errors, or other damages arising from the use of this software. Users should verify all outputs and use the tool at your own risk.
- π Run during off-peak hours for faster downloads
- β Be patient - large notebooks may take 30+ minutes
- πΎ Keep multiple backup copies in different locations
- π Try different tools to backup your data.
- π Verify the data after backup.
This project is licensed under the MIT License with Commercial Restriction.
- π§βπ¬ Academic, personal, and non-commercial use: Free
- πΌ Commercial use: Contact me