Has anyone had any idea how to allow GH perform “Auto-cell spacing” option to MS Excel?
I think the underrated Bumblebee excel plugin does it !
Find the ‘Microsoft.Office.Interop.Excel.dll’ file on your local drive before running the script below:
from System.Runtime.InteropServices import Marshal import clr excelInter_dll_filePath = "C:\libraries\excel\Microsoft.Office.Interop.Excel.dll" try: clr.AddReferenceToFileAndPath(excelInter_dll_filePath) except: raise ValueError("'Microsoft.Office.Interop.Excel.dll' library was not loaded. Check its path.") Excel_dll_loaded_Success = "Microsoft.Office.Interop.Excel" in [assembly.GetName().Name for assembly in clr.References] if Excel_dll_loaded_Success: from Microsoft.Office.Interop import Excel try: excel_COMobj = Marshal.GetActiveObject("Excel.Application") except Exception, e: excel_COMobj = None excel = Marshal.CreateWrapperOfType(excel_COMobj, Excel.ApplicationClass) activeWorksheet = excel.ActiveSheet for i in xrange(activeWorksheet.UsedRange.Columns.Count): activeWorksheet.Columns.AutoFit()