LibreOffice Calc
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: Spreadsheet creation, format conversion (ODS/XLSX/CSV), formulas, data automation with LibreOffice Calc. 4category: Document Processing5source: antigravity6tags: [python, pdf, xlsx, api, ai, automation, workflow, template, document, spreadsheet]7url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/libreoffice/calc8metadata:9 source: https://skillmd.com/skills/sickn33/calc10---111213# LibreOffice Calc1415## Overview1617LibreOffice Calc skill for creating, editing, converting, and automating spreadsheet workflows using the native ODS (OpenDocument Spreadsheet) format.1819## When to Use This Skill2021Use this skill when:22- Creating new spreadsheets in ODS format23- Converting between ODS, XLSX, CSV, PDF formats24- Automating data processing and analysis25- Creating formulas, charts, and pivot tables26- Batch processing spreadsheet operations2728## Core Capabilities2930### 1. Spreadsheet Creation31- Create new ODS spreadsheets from scratch32- Generate spreadsheets from templates33- Create data entry forms34- Build dashboards and reports3536### 2. Format Conversion37- ODS to other formats: XLSX, CSV, PDF, HTML38- Other formats to ODS: XLSX, XLS, CSV, DBF39- Batch conversion of multiple files4041### 3. Data Automation42- Formula automation and calculations43- Data import from CSV, database, APIs44- Data export to various formats45- Batch data processing4647### 4. Data Analysis48- Pivot tables and data summarization49- Statistical functions and analysis50- Data validation and filtering51- Conditional formatting5253### 5. Integration54- Command-line automation via soffice55- Python scripting with UNO56- Database connectivity5758## Workflows5960### Creating a New Spreadsheet6162#### Method 1: Command-Line63```bash64soffice --calc template.ods65```6667#### Method 2: Python with UNO68```python69import uno7071def create_spreadsheet():72 local_ctx = uno.getComponentContext()73 resolver = local_ctx.ServiceManager.createInstanceWithContext(74 "com.sun.star.bridge.UnoUrlResolver", local_ctx75 )76 ctx = resolver.resolve(77 "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"78 )79 smgr = ctx.ServiceManager80 doc = smgr.createInstanceWithContext("com.sun.star.sheet.SpreadsheetDocument", ctx)81 sheets = doc.getSheets()82 sheet = sheets.getByIndex(0)83 cell = sheet.getCellByPosition(0, 0)84 cell.setString("Hello from LibreOffice Calc!")85 doc.storeToURL("file:///path/to/spreadsheet.ods", ())86 doc.close(True)87```8889#### Method 3: Using ezodf90```python91import ezodf9293doc = ezodf.newdoc('ods', 'spreadsheet.ods')94sheet = doc.sheets[0]95sheet['A1'].set_value('Hello')96sheet['B1'].set_value('World')97doc.save()98```99100### Converting Spreadsheets101102```bash103# ODS to XLSX104soffice --headless --convert-to xlsx spreadsheet.ods105106# ODS to CSV107soffice --headless --convert-to csv spreadsheet.ods108109# ODS to PDF110soffice --headless --convert-to pdf spreadsheet.ods111112# XLSX to ODS113soffice --headless --convert-to ods spreadsheet.xlsx114115# Batch convert116for file in *.ods; do117 soffice --headless --convert-to xlsx "$file"118done119```120121### Formula Automation122```python123import uno124125def create_formula_spreadsheet():126 local_ctx = uno.getComponentContext()127 resolver = local_ctx.ServiceManager.createInstanceWithContext(128 "com.sun.star.bridge.UnoUrlResolver", local_ctx129 )130 ctx = resolver.resolve(131 "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"132 )133 smgr = ctx.ServiceManager134 doc = smgr.createInstanceWithContext("com.sun.star.sheet.SpreadsheetDocument", ctx)135 sheet = doc.getSheets().getByIndex(0)136 137 sheet.getCellByPosition(0, 0).setDoubleValue(100)138 sheet.getCellByPosition(0, 1).setDoubleValue(200)139 140 cell = sheet.getCellByPosition(0, 2)141 cell.setFormula("SUM(A1:A2)")142 143 doc.storeToURL("file:///path/to/formulas.ods", ())144 doc.close(True)145```146147## Format Conversion Reference148149### Supported Input Formats150- ODS (native), XLSX, XLS, CSV, DBF, HTML151152### Supported Output Formats153- ODS, XLSX, XLS, CSV, PDF, HTML154155## Command-Line Reference156157```bash158soffice --headless159soffice --headless --convert-to <format> <file>160soffice --calc # Calc161```162163## Python Libraries164165```bash166pip install ezodf # ODS handling167pip install odfpy # ODF manipulation168pip install pandas # Data analysis169```170171## Best Practices1721731. Use named ranges for clarity1742. Document complex formulas1753. Use data validation for input control1764. Create templates for recurring reports1775. Store ODS source files in version control1786. Test conversions thoroughly1797. Use CSV for data exchange1808. Handle conversion failures gracefully181182## Troubleshooting183184### Cannot open socket185```bash186killall soffice.bin187soffice --headless --accept="socket,host=localhost,port=8100;urp;"188```189190## Resources191192- [LibreOffice Calc Guide](https://documentation.libreoffice.org/)193- [UNO API Reference](https://api.libreoffice.org/)194- [ezodf Documentation](http://ezodf.rst2.org/)195196## Related Skills197198- writer199- impress200- draw201- base202- xlsx-official203- workflow-automation204205## Limitations206- Use this skill only when the task clearly matches the scope described above.207- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.208- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.