python解析excel文件1

此python项目是通过这个python脚本read_excel_file.py解析 输出excel多少行, 多少列。

应用介绍

解析excel文件内容如下:

Segment Country  Product   Discount Band  Units Sold  Manufacturing Price 
Government Canada  Carretera   None  1618.5  $3.00 
Government Germany  Carretera   None  1321  $3.00 
Midmarket France  Carretera   None  2178  $3.00 
Midmarket Germany  Carretera   None  888  $3.00 
Midmarket Mexico  Carretera   None  2470  $3.00 
Government Germany  Carretera   None  1513  $3.00 
Midmarket Germany  Montana   None  921  $5.00 
Channel Partners Canada  Montana   None  2518  $5.00 
Government France  Montana   None  1899  $5.00 
Channel Partners Germany  Montana   None  1545  $5.00 
Midmarket Mexico  Montana   None  2470  $5.00 
Enterprise Canada  Montana   None  2665.5  $5.00 
Small Business Mexico  Montana   None  958  $5.00 
Government Germany  Montana   None  2146  $5.00 
Enterprise Canada  Montana   None  345  $5.00 
Midmarket United States of America  Montana   None  615  $5.00 
Government Canada  Paseo   None  292  $10.00 
Midmarket Mexico  Paseo   None  974  $10.00 
Channel Partners Canada  Paseo   None  2518  $10.00 
Government Germany  Paseo   None  1006  $10.00 
Channel Partners Germany  Paseo   None  367  $10.00 
Government Mexico  Paseo   None  883  $10.00 
Midmarket France  Paseo   None  549  $10.00 
Small Business Mexico  Paseo   None  788  $10.00 
Midmarket Mexico  Paseo   None  2472  $10.00 
Government United States of America  Paseo   None  1143  $10.00 
Government Canada  Paseo   None  1725  $10.00 
Channel Partners United States of America  Paseo   None  912  $10.00 
Midmarket Canada  Paseo   None  2152  $10.00 
Government Canada  Paseo   None  1817  $10.00 
Government Germany  Paseo   None  1513  $10.00 

python解析csv文件代码

# extract number of rows using Python
import xlrd

# Give the location of the file
loc = ("sample.xlsx")
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
sheet.cell_value(0, 0)
# Extracting number of rows
print(sheet.nrows)

# extract number of columns in Python
print(sheet.ncols)

# extracting all columns name in Python
for i in range(sheet.ncols):
    print(sheet.cell_value(0, i))

# extracting first column
sheet = wb.sheet_by_index(0)
for i in range(sheet.nrows):
    print(sheet.cell_value(i, 0))

# extract a particular row value
sheet = wb.sheet_by_index(0)
print(sheet.row_values(1))

通过这个python脚本read_excel_file.py解析

输出excel多少行, 多少列

输出如下:

701

16

Segment

Country

Product

Discount Band

Units Sold

Manufacturing Price

Sale Price

Gross Sales

Discounts

 Sales

COGS

Profit

Date

Month Number

Month Name

Year

Segment

Government

Government

Midmarket

Midmarket

Midmarket

Government

Midmarket

Channel Partners

Government

Channel Partners

Midmarket

Enterprise

Small Business

Government

Enterprise

Midmarket

Government

Midmarket

Channel Partners

Government

Channel Partners

Government

Midmarket

Small Business

Midmarket

Government

Government

Channel Partners

Midmarket

Government

Government

Government

Enterprise

Channel Partners

Government

Channel Partners

Enterprise

Enterprise

Small Business

Channel Partners

Midmarket

Midmarket

Government

Small Business

Government

Government

Channel Partners

Enterprise

Government

Government

Channel Partners

Government

Midmarket

Government

Midmarket

Government

Government

Government

Channel Partners

Government

Government

Channel Partners

Enterprise

Channel Partners

Channel Partners

Small Business

Government

Government

Midmarket

Small Business

Government

Government

Small Business

Enterprise

Midmarket

Government

Enterprise

Enterprise

Enterprise

Midmarket

Channel Partners

Small Business

Government

Government

Government

Enterprise

Enterprise

Government

Government

Government

Enterprise

Enterprise

Small Business

Small Business

Government

Enterprise

Channel Partners

Midmarket

Enterprise

Channel Partners

Small Business

Government

Government

Channel Partners

Government

Channel Partners

Enterprise

Midmarket

Small Business

Small Business

Channel Partners

Enterprise

Channel Partners

Enterprise

Enterprise

Channel Partners

Small Business

Government

Enterprise

Midmarket

Government

Channel Partners

Channel Partners

Government

Government

Government

Enterprise

Enterprise

Channel Partners

Government

Channel Partners

Enterprise

Small Business

Government

Enterprise

Government

Government

Small Business

Small Business

Enterprise

Government

Government

Government

Small Business

Enterprise

Government

Small Business

Channel Partners

Channel Partners

Government

Channel Partners

Government

Government

Enterprise

Enterprise

Small Business

Enterprise

Channel Partners

Small Business

Enterprise

Channel Partners

Enterprise

Midmarket

Enterprise

Enterprise

Enterprise

Small Business

Channel Partners

Enterprise

Small Business

Government

Midmarket

Government

Government

Government

Channel Partners

Midmarket

Midmarket

Midmarket

Government

Government

Small Business

Government

Midmarket

Small Business

Government

Small Business

Enterprise

Government

Enterprise

Small Business

Small Business

Government

Enterprise

Midmarket

Government

Government

Midmarket

Midmarket

Government

Enterprise

Channel Partners

Government

Government

Channel Partners

Government

Government

Midmarket

Government

Enterprise

Government

Midmarket

Government

Government

Government

Government

Government

Channel Partners

Channel Partners

Government

Government

Channel Partners

Government

Channel Partners

Channel Partners

Government

Small Business

Government

Midmarket

Government

Government

Government

Enterprise

Government

Channel Partners

Small Business

Government

Enterprise

Enterprise

Small Business

Government

Small Business

Government

Midmarket

Government

Government

Enterprise

Enterprise

Government

Government

Government

Midmarket

Midmarket

Midmarket

Enterprise

Government

Government

Government

Enterprise

Enterprise

Government

Small Business

Government

Government

Government

Government

Government

Government

Government

Government

Government

Small Business

Midmarket

Government

Midmarket

Channel Partners

Channel Partners

Midmarket

Government

Enterprise

Government

Government

Government

Channel Partners

Government

Channel Partners

Government

Enterprise

Enterprise

Midmarket

Government

Government

Small Business

Government

Midmarket

Government

Small Business

Government

Small Business

Enterprise

Government

Government

Government

Government

Government

Midmarket

Midmarket

Midmarket

Government

Government

Government

Midmarket

Channel Partners

Channel Partners

Government

Channel Partners

Channel Partners

Government

Midmarket

Government

Government

Government

Channel Partners

Channel Partners

Government

Government

Government

Small Business

Small Business

Government

Small Business

Enterprise

Small Business

Small Business

Enterprise

Midmarket

Midmarket

Government

Small Business

Small Business

Channel Partners

Government

Small Business

Government

Enterprise

Government

Government

Small Business

Government

Channel Partners

Small Business

Small Business

Enterprise

Government

Enterprise

Government

Small Business

Government

Government

Government

Government

Enterprise

Midmarket

Government

Midmarket

Government

Government

Small Business

Small Business

Midmarket

Enterprise

Government

Government

Government

Small Business

Government

Government

Government

Government

Government

Government

Government

Government

Channel Partners

Government

Government

Small Business

Small Business

Government

Government

Government

Government

Small Business

Small Business

Government

Government

Government

Small Business

Government

Midmarket

Channel Partners

Small Business

Government

Small Business

Channel Partners

Small Business

Government

Small Business

Channel Partners

Enterprise

Government

Enterprise

Small Business

Small Business

Government

Midmarket

Small Business

Midmarket

Channel Partners

Small Business

Channel Partners

Enterprise

Midmarket

Small Business

Government

Enterprise

Enterprise

Government

Channel Partners

Small Business

Government

Channel Partners

Small Business

Channel Partners

Midmarket

Enterprise

Government

Government

Midmarket

Government

Government

Government

Channel Partners

Government

Government

Government

Government

Channel Partners

Midmarket

Government

Government

Government

Government

Midmarket

Channel Partners

Channel Partners

Government

Channel Partners

Enterprise

Enterprise

Government

Enterprise

Midmarket

Government

Small Business

Midmarket

Government

Midmarket

Midmarket

Midmarket

Government

Enterprise

Small Business

Government

Government

Enterprise

Small Business

Enterprise

Midmarket

Government

Small Business

Small Business

Midmarket

Enterprise

Government

Enterprise

Government

Small Business

Channel Partners

Government

Channel Partners

Government

Midmarket

Small Business

Channel Partners

Government

Channel Partners

Midmarket

Channel Partners

Government

Channel Partners

Midmarket

Channel Partners

Channel Partners

Government

Small Business

Enterprise

Midmarket

Government

Government

Government

Midmarket

Small Business

Government

Government

Channel Partners

Channel Partners

Government

Midmarket

Enterprise

Government

Small Business

Government

Midmarket

Government

Government

Channel Partners

Enterprise

Government

Enterprise

Government

Enterprise

Enterprise

Government

Midmarket

Government

Government

Enterprise

Enterprise

Midmarket

Midmarket

Small Business

Government

Government

Government

Small Business

Small Business

Government

Enterprise

Government

Government

Government

Small Business

Small Business

Government

Midmarket

Government

Government

Government

Government

Channel Partners

Midmarket

Government

Government

Enterprise

Government

Government

Government

Government

Midmarket

Government

Channel Partners

Government

Government

Government

Channel Partners

Midmarket

Midmarket

Government

Government

Government

Government

Government

Channel Partners

Government

Government

Government

Small Business

Government

Government

Government

Enterprise

Channel Partners

Government

Midmarket

Government

Government

Channel Partners

Midmarket

Government

Government

Channel Partners

Midmarket

Channel Partners

Small Business

Channel Partners

Enterprise

Midmarket

Enterprise

Government

Channel Partners

Channel Partners

Government

Government

Government

Government

Government

Government

Midmarket

Government

Midmarket

Channel Partners

Government

Channel Partners

Channel Partners

Small Business

Enterprise

Small Business

Small Business

Midmarket

Midmarket

Enterprise

Government

Government

Government

Government

Government

Midmarket

Government

Midmarket

Midmarket

Channel Partners

Government

Government

Channel Partners

Government

Government

Enterprise

Government

Small Business

Small Business

Small Business

Government

Small Business

Small Business

Small Business

Small Business

文件列表(部分)

名称 大小 修改日期
read_excel_file.py0.28 KB2020-02-22
sample.xlsx75.73 KB2020-02-22
解析csv0.00 KB2020-02-25

立即下载

相关下载

[python解析excel文件1] 此python项目是通过这个python脚本read_excel_file.py解析 输出excel多少行, 多少列。

评论列表 共有 0 条评论

暂无评论

微信捐赠

微信扫一扫体验

立即
上传
发表
评论
返回
顶部