code: public static function sizeCol($sheet, $col = 'A')
      {
          // default font of the workbook
          $font = $sheet->getParent()->getDefaultStyle()->getFont();
  
          $columnDimensions = $sheet->getColumnDimensions();
  
          // first find the true column width in pixels (uncollapsed and unhidden)
          if (isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1) {
              // then we have column dimension with explicit width
              $columnDimension = $columnDimensions[$col];
              $width = $columnDimension->getWidth();
              $pixelWidth = Drawing::cellDimensionToPixels($width, $font);
          } elseif ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
              // then we have default column dimension with explicit width
              $defaultColumnDimension = $sheet->getDefaultColumnDimension();
              $width = $defaultColumnDimension->getWidth();
              $pixelWidth = Drawing::cellDimensionToPixels($width, $font);
          } else {
              // we don't even have any default column dimension. Width depends on default font
              $pixelWidth = Font::getDefaultColumnWidthByFont($font, true);
          }
  
          // now find the effective column width in pixels
          if (isset($columnDimensions[$col]) and !$columnDimensions[$col]->getVisible()) {
              $effectivePixelWidth = 0;
          } else {
              $effectivePixelWidth = $pixelWidth;
          }
  
          return $effectivePixelWidth;
      }
docs: Get the width of a column in pixels. We use the relationship y = ceil(7x) where
  x is the width in intrinsic Excel units (measuring width in number of normal characters)
  This holds for Arial 10.
  
  @param Worksheet $sheet The sheet
  @param string $col The column
  
  @return int The width in pixels