import xlwings as xw
import numpy as np
import pandas as pd
import datetime as dt
import time
import sys
#* Workaround for missing features: Manipulate the underlying object
wb = xw.Book()
sheet = wb.sheets[0]
# On Windows, the underlying object is a pywin32 COM object
# On Mac, the underlying object is an appscript object
sheet.range('A1').api # same for the other objects
sheet.range('A10').value = 1
sheet.range('A10').color = (255, 0, 0)
# Code that makes use of the api property will be platform dependent (!)
# clear format, delete format:
if sys.platform.startswith('darwin'):
# Mac version (appscript syntax)
sheet.range('A10').api.clear_formats()
elif sys.platform.startswith('win'):
# Windows version (pywin32 syntax)
sheet.range('A10').api.ClearFormats()