可以用powershell吗, 贴一段AI上推荐的代码 # Install the ImportExcel module if not already installed Install-Module -Name ImportExcel -Scope CurrentUser -Force # Import the module Import-Module ImportExcel # Specify the path to your Excel file $filePath = "C:\path\to\your\file.xlsx" # Read the Excel file into a PowerShell object $data = Import-Excel -Path $filePath # Loop through each row in the Excel data foreach ($row in $data) { # Loop through each column in the row foreach ($column in $row.PSObject.Properties) { # Get the cell value $cellValue = $column.Value # Check if the cell value is not null or empty if (![string]::IsNullOrEmpty($cellValue)) { # Get the length of the cell value $length = $cellValue.Length # Print the cell value and its length Write-Host "Cell: $($column.Name), Value: $cellValue, Length: $length" } } }
# Install the ImportExcel module if not already installed Install-Module -Name ImportExcel -Scope CurrentUser -Force
# Import the module Import-Module ImportExcel
# Specify the path to your Excel file $filePath = "C:\path\to\your\file.xlsx"
# Read the Excel file into a PowerShell object $data = Import-Excel -Path $filePath
# Loop through each row in the Excel data foreach ($row in $data) { # Loop through each column in the row foreach ($column in $row.PSObject.Properties) { # Get the cell value $cellValue = $column.Value
# Check if the cell value is not null or empty if (![string]::IsNullOrEmpty($cellValue)) { # Get the length of the cell value $length = $cellValue.Length
# Print the cell value and its length Write-Host "Cell: $($column.Name), Value: $cellValue, Length: $length" } } }
可以把A:Z换成你想要的任何范围。这个公式可以计算出这个范围里一共有多少个characters。