use python to process the excel files
时间: 2024-05-10 14:15:48 浏览: 81
Sure, you can use the openpyxl module in Python to process Excel files. Here's an example of how to read data from an Excel file:
```python
import openpyxl
# Load the workbook
workbook = openpyxl.load_workbook('example.xlsx')
# Select the sheet you want to read from
sheet = workbook['Sheet1']
# Get the value of a cell
cell_value = sheet['A1'].value
# Iterate over all rows in the sheet
for row in sheet.iter_rows(min_row=2, values_only=True):
# Access the values in each column
column1, column2, column3 = row
# Do something with the values
print(column1, column2, column3)
```
You can also use openpyxl to create, modify, and save Excel files. Check out the official documentation for more information: https://openpyxl.readthedocs.io/en/stable/
阅读全文