[英]i want to save a particular column into a new excel sheet in python
if this is the spread sheet then I want to make a new spreadsheet containing only product id
:如果这是电子表格,那么我想制作一个仅包含
product id
的新电子表格:
transaction id product id
1001 1
1002 2
1003 3
the code I have written so far I am able to print a particular column到目前为止我编写的代码我能够打印一个特定的列
import openpyxl as xl
from openpyxl import Workbook
wb = xl.load_workbook('transactions.xlsx')
sheet = wb['Sheet1']
book = Workbook()
x = input("row name")
y=int(x)
book.save("sample.xlsx")
for row in sheet.rows:
print(row[y].value)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.