LibreOffice Calc
Selective Reading Rule
Start with:
references/senior-master-standard.md
references/usage-routing.md
references/quality-checklist.md
Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.
Overview
LibreOffice Calc skill for creating, editing, converting, and automating spreadsheet workflows using the native ODS (OpenDocument Spreadsheet) format.
When to Use This Skill
Use this skill when:
- Creating new spreadsheets in ODS format
- Converting between ODS, XLSX, CSV, PDF formats
- Automating data processing and analysis
- Creating formulas, charts, and pivot tables
- Batch processing spreadsheet operations
Core Capabilities
1. Spreadsheet Creation
- Create new ODS spreadsheets from scratch
- Generate spreadsheets from templates
- Create data entry forms
- Build dashboards and reports
2. Format Conversion
- ODS to other formats: XLSX, CSV, PDF, HTML
- Other formats to ODS: XLSX, XLS, CSV, DBF
- Batch conversion of multiple files
3. Data Automation
- Formula automation and calculations
- Data import from CSV, database, APIs
- Data export to various formats
- Batch data processing
4. Data Analysis
- Pivot tables and data summarization
- Statistical functions and analysis
- Data validation and filtering
- Conditional formatting
5. Integration
- Command-line automation via soffice
- Python scripting with UNO
- Database connectivity
Workflows
Creating a New Spreadsheet
Method 1: Command-Line
soffice --calc template.ods
Method 2: Python with UNO
import uno
def create_spreadsheet():
local_ctx = uno.getComponentContext()
resolver = local_ctx.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", local_ctx
)
ctx = resolver.resolve(
"uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"
)
smgr = ctx.ServiceManager
doc = smgr.createInstanceWithContext("com.sun.star.sheet.SpreadsheetDocument", ctx)
sheets = doc.getSheets()
sheet = sheets.getByIndex(0)
cell = sheet.getCellByPosition(0, 0)
cell.setString("Hello from LibreOffice Calc!")
doc.storeToURL("file:///path/to/spreadsheet.ods", ())
doc.close(True)
Method 3: Using ezodf
import ezodf
doc = ezodf.newdoc('ods', 'spreadsheet.ods')
sheet = doc.sheets[0]
sheet['A1'].set_value('Hello')
sheet['B1'].set_value('World')
doc.save()
Converting Spreadsheets
# ODS to XLSX
soffice --headless --convert-to xlsx spreadsheet.ods
# ODS to CSV
soffice --headless --convert-to csv spreadsheet.ods
# ODS to PDF
soffice --headless --convert-to pdf spreadsheet.ods
# XLSX to ODS
soffice --headless --convert-to ods spreadsheet.xlsx
# Batch convert
for file in *.ods; do
soffice --headless --convert-to xlsx "$file"
done
Formula Automation
import uno
def create_formula_spreadsheet():
local_ctx = uno.getComponentContext()
resolver = local_ctx.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", local_ctx
)
ctx = resolver.resolve(
"uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"
)
smgr = ctx.ServiceManager
doc = smgr.createInstanceWithContext("com.sun.star.sheet.SpreadsheetDocument", ctx)
sheet = doc.getSheets().getByIndex(0)
sheet.getCellByPosition(0, 0).setDoubleValue(100)
sheet.getCellByPosition(0, 1).setDoubleValue(200)
cell = sheet.getCellByPosition(0, 2)
cell.setFormula("SUM(A1:A2)")
doc.storeToURL("file:///path/to/formulas.ods", ())
doc.close(True)
Format Conversion Reference
Supported Input Formats
- ODS (native), XLSX, XLS, CSV, DBF, HTML
Supported Output Formats
- ODS, XLSX, XLS, CSV, PDF, HTML
Command-Line Reference
soffice --headless
soffice --headless --convert-to <format> <file>
soffice --calc # Calc
Python Libraries
pip install ezodf # ODS handling
pip install odfpy # ODF manipulation
pip install pandas # Data analysis
Best Practices
- Use named ranges for clarity
- Document complex formulas
- Use data validation for input control
- Create templates for recurring reports
- Store ODS source files in version control
- Test conversions thoroughly
- Use CSV for data exchange
- Handle conversion failures gracefully
Troubleshooting
Cannot open socket
killall soffice.bin
soffice --headless --accept="socket,host=localhost,port=8100;urp;"
Resources
Related Skills
- writer
- impress
- draw
- base
- xlsx-official
- workflow-automation
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---2name: calc3description: ALWAYS use this when the request matches Calc: Spreadsheet creation, format conversion (ODS/XLSX/CSV), formulas, data automation with LibreOffice Calc.4---56# LibreOffice Calc78## Selective Reading Rule910Start with:1112- `references/senior-master-standard.md`13- `references/usage-routing.md`14- `references/quality-checklist.md`1516Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.1718## Overview1920LibreOffice Calc skill for creating, editing, converting, and automating spreadsheet workflows using the native ODS (OpenDocument Spreadsheet) format.2122## When to Use This Skill2324Use this skill when:25- Creating new spreadsheets in ODS format26- Converting between ODS, XLSX, CSV, PDF formats27- Automating data processing and analysis28- Creating formulas, charts, and pivot tables29- Batch processing spreadsheet operations3031## Core Capabilities3233### 1. Spreadsheet Creation34- Create new ODS spreadsheets from scratch35- Generate spreadsheets from templates36- Create data entry forms37- Build dashboards and reports3839### 2. Format Conversion40- ODS to other formats: XLSX, CSV, PDF, HTML41- Other formats to ODS: XLSX, XLS, CSV, DBF42- Batch conversion of multiple files4344### 3. Data Automation45- Formula automation and calculations46- Data import from CSV, database, APIs47- Data export to various formats48- Batch data processing4950### 4. Data Analysis51- Pivot tables and data summarization52- Statistical functions and analysis53- Data validation and filtering54- Conditional formatting5556### 5. Integration57- Command-line automation via soffice58- Python scripting with UNO59- Database connectivity6061## Workflows6263### Creating a New Spreadsheet6465#### Method 1: Command-Line66```bash67soffice --calc template.ods68```6970#### Method 2: Python with UNO71```python72import uno7374def create_spreadsheet():75 local_ctx = uno.getComponentContext()76 resolver = local_ctx.ServiceManager.createInstanceWithContext(77 "com.sun.star.bridge.UnoUrlResolver", local_ctx78 )79 ctx = resolver.resolve(80 "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"81 )82 smgr = ctx.ServiceManager83 doc = smgr.createInstanceWithContext("com.sun.star.sheet.SpreadsheetDocument", ctx)84 sheets = doc.getSheets()85 sheet = sheets.getByIndex(0)86 cell = sheet.getCellByPosition(0, 0)87 cell.setString("Hello from LibreOffice Calc!")88 doc.storeToURL("file:///path/to/spreadsheet.ods", ())89 doc.close(True)90```9192#### Method 3: Using ezodf93```python94import ezodf9596doc = ezodf.newdoc('ods', 'spreadsheet.ods')97sheet = doc.sheets[0]98sheet['A1'].set_value('Hello')99sheet['B1'].set_value('World')100doc.save()101```102103### Converting Spreadsheets104105```bash106# ODS to XLSX107soffice --headless --convert-to xlsx spreadsheet.ods108109# ODS to CSV110soffice --headless --convert-to csv spreadsheet.ods111112# ODS to PDF113soffice --headless --convert-to pdf spreadsheet.ods114115# XLSX to ODS116soffice --headless --convert-to ods spreadsheet.xlsx117118# Batch convert119for file in *.ods; do120 soffice --headless --convert-to xlsx "$file"121done122```123124### Formula Automation125```python126import uno127128def create_formula_spreadsheet():129 local_ctx = uno.getComponentContext()130 resolver = local_ctx.ServiceManager.createInstanceWithContext(131 "com.sun.star.bridge.UnoUrlResolver", local_ctx132 )133 ctx = resolver.resolve(134 "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"135 )136 smgr = ctx.ServiceManager137 doc = smgr.createInstanceWithContext("com.sun.star.sheet.SpreadsheetDocument", ctx)138 sheet = doc.getSheets().getByIndex(0)139 140 sheet.getCellByPosition(0, 0).setDoubleValue(100)141 sheet.getCellByPosition(0, 1).setDoubleValue(200)142 143 cell = sheet.getCellByPosition(0, 2)144 cell.setFormula("SUM(A1:A2)")145 146 doc.storeToURL("file:///path/to/formulas.ods", ())147 doc.close(True)148```149150## Format Conversion Reference151152### Supported Input Formats153- ODS (native), XLSX, XLS, CSV, DBF, HTML154155### Supported Output Formats156- ODS, XLSX, XLS, CSV, PDF, HTML157158## Command-Line Reference159160```bash161soffice --headless162soffice --headless --convert-to <format> <file>163soffice --calc # Calc164```165166## Python Libraries167168```bash169pip install ezodf # ODS handling170pip install odfpy # ODF manipulation171pip install pandas # Data analysis172```173174## Best Practices1751761. Use named ranges for clarity1772. Document complex formulas1783. Use data validation for input control1794. Create templates for recurring reports1805. Store ODS source files in version control1816. Test conversions thoroughly1827. Use CSV for data exchange1838. Handle conversion failures gracefully184185## Troubleshooting186187### Cannot open socket188```bash189killall soffice.bin190soffice --headless --accept="socket,host=localhost,port=8100;urp;"191```192193## Resources194195- [LibreOffice Calc Guide](https://documentation.libreoffice.org/)196- [UNO API Reference](https://api.libreoffice.org/)197- [ezodf Documentation](http://ezodf.rst2.org/)198199## Related Skills200201- writer202- impress203- draw204- base205- xlsx-official206- workflow-automation207208## Limitations209- Use this skill only when the task clearly matches the scope described above.210- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.211- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.