calendar-tabs
v1.0.0
Published
Generate year or single-month calendar grids as tab-, CSV-, or TSV-delimited text for pasting into spreadsheets or scripting date-based reports. Sunday or Monday week start, per-month file splitting, format auto-detected from the output file extension.
Maintainers
Readme
calendar-tabs
Generate a year or single-month calendar grid as tab-, CSV-, or TSV-delimited text — for pasting straight into a spreadsheet, or for scripting date-based reports.
npx calendar-tabs 2026
npx calendar-tabs 2026 2 -o feb.csv
npx calendar-tabs 2026 -o cal.csv -s
npx calendar-tabs --helpOr install it: npm i -g calendar-tabs, then run calendar-tabs ....
Hardened: 2026-10-30 · 3722eba · gate CLOSED WITH FOLLOW-UPS
What it’s good for
Dropping a real calendar grid into a spreadsheet without fighting a spreadsheet app’s own date functions, or generating month-by-month text/CSV/TSV files for a script further down a pipeline. Output format is auto-detected from the -o file extension, so the same command produces tab-delimited text, comma-separated, or tab-separated depending only on what you name the file.
Examples
Print the current year’s grid to the screen (tab-delimited, no header row):
npx calendar-tabs 2026### January 2026
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
### February 2026
1 2 3 4 5 6 7
8 9 10 11 12 13 14
...A single month, written to a CSV file (extension turns on the day-name header row and comma separators):
npx calendar-tabs 2026 1 -o january.csv### January 2026
Sun,Mon,Tue,Wed,Thu,Fri,Sat
,,,,1,2,3
4,5,6,7,8,9,10
11,12,13,14,15,16,17
18,19,20,21,22,23,24
25,26,27,28,29,30,31Monday-start week (-m), same month:
npx calendar-tabs 2026 2 -m### February 2026
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28A full year, split into twelve separate files:
npx calendar-tabs 2026 -o cal.csv -sGenerating separate files in 'current directory'...
✓ Created: cal-01.csv
✓ Created: cal-02.csv
...
✓ Created: cal-12.csvOptions
| Flag | Description |
|---|---|
| -m, --monday | Start the week on Monday. Default is Sunday. |
| -o, --output | Base filename. The extension picks the format: .csv → comma-separated with a day-name header row; .tsv → tab-separated with a header row; anything else (or omitted) → plain tabs, no header. |
| -s, --split | Save each month as its own file (<base>-01.<ext> … <base>-12.<ext>) instead of one combined file. Without -o, the base name is the year and the extension .txt. |
| -h, --help | Show usage and exit. |
Arguments
| Argument | Description |
|---|---|
| year | The year to generate, a whole number from 1 to 9999, e.g. 2026. Required. Years below 100 mean what they say: 50 is AD 50, not 1950. |
| month | Optional month number, 1–12 (02 is fine; names like feb are not accepted). Omit it to generate the whole year. |
Notes
Without
-o, output goes to stdout.With
-obut without-s, all requested months are written to the one file, separated by a blank line.With
-sand no-o, each month is still split into its own file, named<year>-01.txt…<year>-12.txtin the current directory.With
-oand-s, each month is written to its own file:<base>-01.<ext>…<base>-12.<ext>.Dates are computed in UTC on the proleptic Gregorian calendar, so the grid is the same in every time zone.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success (including --help). |
| 1 | A file could not be written. In -s mode the other months are still written, and the run exits 1 if any one failed. |
| 2 | Bad command line: an unknown flag, a missing option value, a year outside 1–9999, a month outside 1–12, or more than two arguments. Nothing is printed to stdout and no file is written. |
Known limits
The calendar is proleptic Gregorian for every year. Dates before the Gregorian reform (1582, or 1752 in Britain and its colonies) do not match the Julian calendar in use at the time; the BSD
calcommand, for one, switches to Julian before September 1752, so it disagrees with this tool for those years.An output name that is only an extension, such as
-o .csv, is treated as a file named.csvwith no extension, so it gets plain tabs. Give the file a name (-o cal.csv).Not tested on Windows (paths and line endings).
Requirements
Node 18.3 or later (for util.parseArgs).
