如何找出用了最多byte的tab in an excel file?

s
shunyi
楼主 (北美华人网)
不能用vba code找,单存每个sheet看size 不现实,问了deepseek and gpt,没更好的主意,查了每个tab,没看到哪个tab有几千空白行,没有特殊formula,不想把excel另存成别的格式
n
njw
可以用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"     }   } }
s
shunyi
不能用编程的方法,到现在还没找到哪个tab这么大。
a
aegeanboat
=SUMPRODUCT(LEN(A:Z))
可以把A:Z换成你想要的任何范围。这个公式可以计算出这个范围里一共有多少个characters。