Skip to content

command raw excel

zmworm edited this page Apr 29, 2026 · 51 revisions

raw / raw-set - Excel (.xlsx)

Raw XML operations for Excel documents.

Available Parts

Part Path Description
/ or /workbook Workbook root XML
/styles Stylesheet XML (fonts, fills, borders, number formats)
/sharedstrings Shared string table XML
/{SheetName} Worksheet XML
/{SheetName}/drawing Drawing/chart container XML
/{SheetName}/chart[N] Specific chart XML (1-based)
/chart[N] Global chart search across all sheets (1-based)

XPath Namespace Prefixes

Prefix Namespace Description
x SpreadsheetML Main Excel namespace (sheets, cells, rows)
r Relationships Relationship references
a DrawingML Drawing elements
c Charts Chart elements
xdr Spreadsheet Drawing Drawing positioning

raw Examples

# View workbook XML
officecli raw data.xlsx /workbook

# View worksheet XML
officecli raw data.xlsx /Sheet1

# View with row range
officecli raw data.xlsx /Sheet1 --start 1 --end 50

# View with column filter
officecli raw data.xlsx /Sheet1 --cols A,B,C

# View with both row range and column filter
officecli raw data.xlsx /Sheet1 --start 1 --end 100 --cols A,B,C,D

# View stylesheet
officecli raw data.xlsx /styles

# View shared strings
officecli raw data.xlsx /sharedstrings

# View chart XML
officecli raw data.xlsx /Sheet1/chart[1]

# View drawing container
officecli raw data.xlsx /Sheet1/drawing

raw-set Examples

# Modify a shared string
officecli raw-set data.xlsx /sharedstrings \
  --xpath "//x:si[1]/x:t" \
  --action replace \
  --xml '<x:t>New value</x:t>'

# Add a row to a worksheet
officecli raw-set data.xlsx /Sheet1 \
  --xpath "//x:sheetData" \
  --action append \
  --xml '<x:row r="100"><x:c r="A100" t="s"><x:v>0</x:v></x:c></x:row>'

# Remove a conditional formatting rule
officecli raw-set data.xlsx /Sheet1 \
  --xpath "//x:conditionalFormatting[1]" \
  --action remove

# Set a cell attribute
officecli raw-set data.xlsx /Sheet1 \
  --xpath "//x:row[@r=1]/x:c[@r='A1']" \
  --action setattr \
  --xml "s=2"

# Add a defined name to workbook
officecli raw-set data.xlsx /workbook \
  --xpath "//x:definedNames" \
  --action append \
  --xml '<x:definedName name="MyRange">Sheet1!$A$1:$D$100</x:definedName>'

add-part Examples

# Create a new chart part on a sheet
officecli add-part data.xlsx /Sheet1 --type chart
# Returns: relId=rId3, partPath=/xl/charts/chart1.xml

See Also


Based on OfficeCLI v1.0.64

Clone this wiki locally