Skip to main content

Convert table data to json format output

Project description

simple-xls2json

Convert table data to json format output

Requirements

  • xlrd

Installation

pip3 install simple-xls2json

Usage

from xls2json.xls2json import *

xls = Xls2Json()
xls.setConfig(
        Config().start(1).end(-1) # configure the startline & endline, -1 for end means all lines
        .values([(0, 'click_time'), (1, 'create_time')])    # configure which columns to be used, set the keys
        .value(2, 'pay_time')
        .value(3, 'balance_time')
        .value(5, 'item_id')
        .value(6, 'pic')
        .value(7, 'title')
        .value(11, 'price')
        )
xls.toJson('test.xls')

Output

{
    "code":0,
    "pageCount":1,
    "pages":[
        {
            "name":"Page1",
            "lines":[
                {
                    "click_time":"2020-06-16 23:28:11",
                    "create_time":"2020-06-17 00:24:02",
                    "pay_time":"2020-06-17 00:24:12",
                    "balance_time":"2020-07-07 21:54:53",
                    "item_id":"521537285175",
                    "pic":"//img.alicdn.com/tfscom/i4/2185500387/TB2Z2bvnSVmpuFjSZFFXXcZApXa_!!2185500387.jpg",
                    "title":"Bellroy澳洲进口Coin Fold折叠硬币信用卡片收纳包皮夹卡包男包邮",
                    "price":"528.00"
                },
                {
                    "click_time":"2020-06-16 23:28:11",
                    "create_time":"2020-06-17 00:24:02",
                    "pay_time":"2020-06-17 00:24:12",
                    "balance_time":"2020-07-07 21:54:53",
                    "item_id":"521537285175",
                    "pic":"//img.alicdn.com/tfscom/i4/2185500387/TB2Z2bvnSVmpuFjSZFFXXcZApXa_!!2185500387.jpg",
                    "title":"Bellroy澳洲进口Coin Fold折叠硬币信用卡片收纳包皮夹卡包男包邮",
                    "price":"528.00"
                },
                {
                    "click_time":"2020-06-16 23:28:11",
                    "create_time":"2020-06-17 00:24:02",
                    "pay_time":"2020-06-17 00:24:12",
                    "balance_time":"2020-07-07 21:54:53",
                    "item_id":"521537285175",
                    "pic":"//img.alicdn.com/tfscom/i4/2185500387/TB2Z2bvnSVmpuFjSZFFXXcZApXa_!!2185500387.jpg",
                    "title":"Bellroy澳洲进口Coin Fold折叠硬币信用卡片收纳包皮夹卡包男包邮",
                    "price":"528.00"
                },
                {
                    "click_time":"2020-06-16 23:28:11",
                    "create_time":"2020-06-17 00:24:02",
                    "pay_time":"2020-06-17 00:24:12",
                    "balance_time":"2020-07-07 21:54:53",
                    "item_id":"521537285175",
                    "pic":"//img.alicdn.com/tfscom/i4/2185500387/TB2Z2bvnSVmpuFjSZFFXXcZApXa_!!2185500387.jpg",
                    "title":"Bellroy澳洲进口Coin Fold折叠硬币信用卡片收纳包皮夹卡包男包邮",
                    "price":"528.00"
                }
            ]
        }
    ]
}

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

simple-xls2json-1.0.5.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file simple-xls2json-1.0.5.tar.gz.

File metadata

  • Download URL: simple-xls2json-1.0.5.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.3

File hashes

Hashes for simple-xls2json-1.0.5.tar.gz
Algorithm Hash digest
SHA256 840c863be45355d0607bd1c0c580fa5a7bde3b1a0df69741fdd8a28e43c1cbf0
MD5 c9838a46b8e88a2e7c0885aa886ae25d
BLAKE2b-256 bf9f1a0bd462477742fc287fb7702c4382e4f0e2c4bd6ae53aa8df3a249e7f4d

See more details on using hashes here.

Supported by

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