Skip to main content

Create new file for every row in excel sheet, with support of header and footer replication.

Project description

xlsx-split

Create new file for every row in excel sheet, with support of header and footer replication.

Install

pip install xlsx-split

Installed Commands

  • xlsx-split

Command Helps

    E:\xlsx-split>xlsx-split --help
    Usage: xlsx-split [OPTIONS] WORKBOOK

    Options:
    -h, --header TEXT            Header row number list.
    -f, --footer TEXT            Footer row number list.
    -c, --cols TEXT              Column number list.
    -r, --rows TEXT              Content row number list.
    -t, --test TEXT              Conditions that a good row must matchs. Format
                                like COL_LETTER:REGEX, e.g. A:\d+ means the
                                value of A column must be an Integer.
    -s, --sheet TEXT             Sheet name. Default to Current Active Sheet
    -w, --workspace TEXT         Where new files saved. Default to
                                "{FILENAME_ROOT}"
    -p, --filename-pattern TEXT  Default to
                                "{FILENAME_ROOT}-{ROW}.{FILENAME_EXT}"
    --help                       Show this message and exit.

Notice

  • header/footer/rows obeys ROWS-RULE.
  • cols obeys COLS-RULE.
  • test obeys TEST-RULE。
  • filename-pattern obeys FILENAME-RULE。

ROWS-RULE

  • 1 == [1]
  • 1,2,3 == [1,2,3]
  • 1-3 == [1,2,3]
  • 1-3,5 == [1,2,3,5]
  • 3- == [3,4,5,6....] # From the third row to the sheet.max_rows

COLS-RULE

  • A == [1]
  • A,B,C == [1,2,3]
  • A-C == [1,2,3]
  • A-C,E == [1,2,3,5]
  • C- == [3,4,5,6....] # From column C to the sheet.max_cols

TEST-RULE

  • Can provide multiple tests.
  • The final result is the result of LOGIC AND of all tests result.
  • Test format: Column:TestRegex, e.g. A:\d+ means the Column A must contain digits.

FILENAME-RULE

  • filename-pattern is a python string format template.
  • Available variables
    • FILEPATH Source file's full path, e.g. c:\a\b.xlsx
    • DIRNAME Source file's direct folder path, e.g. c:\a
    • FILENAME Source file's filename, e.g. b.xlsx
    • FILENAME_ROOT Source file's filename without ext, e.g. b
    • FILENAME_EXT Source file's file ext, e.g. .xlsx
    • ROW Index of current row,如1,2,3...
    • A..Z,AA... The value of the cell [ROW, COLUMN]. A or Z or ZZ is the column.

Releases

0.1.2

  • Fix parse_rows & parse_cols problem.
  • Document changes.

0.1.1

  • Document changes.

0.1.0

  • First release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlsx-split-0.1.2.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file xlsx-split-0.1.2.tar.gz.

File metadata

  • Download URL: xlsx-split-0.1.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for xlsx-split-0.1.2.tar.gz
Algorithm Hash digest
SHA256 83380f58997ff4f9e6ffa204dbc21a99b9d00049bb27b2e4ec874a8c810e2479
MD5 ed891af8bdfddb6c5d9325e68354b3c2
BLAKE2b-256 2a1a38760f784ed169f22ce7c1092b231414e5b2242be49d2300aff9b9630b99

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page