-
Notifications
You must be signed in to change notification settings - Fork 541
excel cell set
Modify cell content, style, and row/column properties.
Path: /{SheetName}/A1, /{SheetName}/A1:D10, /{SheetName}/row[N], /{SheetName}/col[A]
| Property | Accepted Values | Description |
|---|---|---|
value |
any | Cell value |
formula |
formula string | Cell formula (e.g., =SUM(A1:A10)). Leading = is auto-stripped |
type |
string/str, number/num, boolean/bool
|
Value type |
clear |
(any value) | Clear content, formula, and style |
link |
URL or none
|
Hyperlink |
| Property | Accepted Values | Description |
|---|---|---|
font.name |
font name | Font family |
font.size |
number (pt) | Font size |
font.bold / bold
|
bool | Bold |
font.italic / italic
|
bool | Italic |
font.strike / strike
|
bool | Strikethrough |
font.underline / underline
|
true, false, single, double
|
Underline |
font.color |
hex RGB | Font color |
fill / bgcolor
|
hex RGB, gradient | Background fill (see below) |
numFmt / numberFormat
|
format code | Number format (e.g., 0%, #,##0.00) |
alignment.horizontal / halign
|
left, center, right, justify
|
Horizontal alignment |
alignment.vertical / valign
|
top, center, bottom
|
Vertical alignment |
alignment.wrapText / wrap
|
bool | Wrap text |
rotation / textrotation
|
0-180, or 255 | Text rotation (255 = vertical) |
indent |
0-15 | Text indent level |
shrinkToFit / shrink
|
bool | Shrink text to fit cell |
border.all |
border style | All borders |
border.left / border.right / border.top / border.bottom
|
border style | Per-side border |
border.color |
hex RGB | All border colors |
border.*.color |
hex RGB | Per-side border color (e.g., border.left.color) |
Gradient fill: Use fill=FF0000-0000FF for a linear gradient (default angle 0), fill=FF0000-0000FF-90 to specify angle in degrees, or fill=radial:FF0000-0000FF for a radial gradient.
Theme colors: font.color and fill accept theme color names as input and return them on readback: lt1, dk1, lt2, dk2, accent1–accent6, hlink, folHlink.
Border styles: thin, medium, thick, double, dashed, dotted, dashDot, dashDotDot, hair, mediumDashed, mediumDashDot, mediumDashDotDot, slantDashDot, none
Number formats: general, 0, 0.00, #,##0, #,##0.00, 0%, 0.00%, or custom format codes
officecli set data.xlsx /Sheet1/A1 --prop value="Updated"
officecli set data.xlsx /Sheet1/A1 --prop bold=true --prop font.size=14 --prop font.color=FF0000
officecli set data.xlsx /Sheet1/A1 --prop fill=FFFF00 --prop halign=center --prop wrap=true
officecli set data.xlsx /Sheet1/A1 --prop border.all=thin --prop border.color=000000
officecli set data.xlsx /Sheet1/A1 --prop numberFormat="#,##0.00"
officecli set data.xlsx /Sheet1/A1 --prop rotation=45 --prop indent=2
officecli set data.xlsx /Sheet1/A1 --prop shrinkToFit=true
officecli set data.xlsx /Sheet1/A1 --prop fill=FF0000-0000FF-90
officecli set data.xlsx /Sheet1/A1 --prop fill=radial:FF0000-0000FFStyle and content properties (bold, color, font size, etc.) are applied to every cell in the range individually. Range-level properties (merge, height, width) apply to the range as a whole.
| Property | Accepted Values | Description |
|---|---|---|
merge |
bool |
true = merge, false = unmerge |
officecli set data.xlsx /Sheet1/A1:D1 --prop merge=true
officecli set data.xlsx /Sheet1/A1:D1 --prop merge=false
# Apply formatting to every cell in range
officecli set data.xlsx /Sheet1/A1:D10 --prop bold=true --prop font.color=FF0000| Property | Accepted Values | Description |
|---|---|---|
height |
number (points) | Row height |
hidden |
bool | Hide/show row |
officecli set data.xlsx /Sheet1/row[1] --prop height=30
officecli set data.xlsx /Sheet1/row[3] --prop hidden=true| Property | Accepted Values | Description |
|---|---|---|
width |
number (characters) | Column width |
hidden |
bool | Hide/show column |
officecli set data.xlsx /Sheet1/col[A] --prop width=20
officecli set data.xlsx /Sheet1/col[B] --prop hidden=trueBased on OfficeCLI v1.0.18