I want to print the amount of space remaining (in GB) on a network share (M: drive), and then take that value and add it to an Excel spreadsheet. I'm very new to programming and need all the help I can get really!
Thanks in advance
EDIT:
Here is what I've managed so far.
import ctypes
from win32com.client import Dispatch
import pythoncom
def drivespace():
#get space in bytes
free_bytes = ctypes.c_ulonglong(0)
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(u'M:\\'), None, None ctypes.pointer(free_bytes))
#calculate space in GB
free_GB = free_bytes.value/1024/1024/1024
print(free_GB)
#input data to Excel
xl = Dispatch ('Excel.Application')
xl.visible = 0
xl.Workbooks.Add (r'C:\Location\Location1\Location2\Book1.xlsm')
xl.Run('Down1') #macro inside the workbook, just to move the cell down 1 row
#here is where I need some help... something to input the data to the active cell
#xl.Cells( ?? ACTIVE CELL HERE BUT DON'T KNOW HOW ?? ).value=(free_GB)
xl.Quit()
#release held Excel process
pythoncom.CoUninitialize()
So basically, I have everything sorted other than actually printing the data in to the active cell. Does anybody have any pywin32 knowledge that may be able to help me do this?
Thanks a bunch!