After i exported data from dataframe to googlesheet, it looked like this:
I wish i can merge repeated columns and get this kind of result:
This is the part of code which is responsible for merging cells:
df1 = wks.get_as_df()
df1 = df1.apply(pd.to_numeric, errors='ignore')
df2 = pd.pivot_table(df1[df1.SSPU == 'K01'],index=['SSPU','Color'],
columns = ["Size"],values=['USFBA',"近30天销量(US)",'US
Turnover'],fill_value=0, aggfunc=sum)
gc=
pygsheets.authorize(service_file='/Users/dongan/PycharmProjects
/PyProjects/AntonGS.json')
sh = gc.open('BU2_EOL库存处理PY')
wks1 = sh[2]
wks1.set_dataframe(df2,(3,3),copy_index=True)
wks1.merge_cells(start='E3', end='J3', merge_type='MERGE_ALL', sheet=[2])
But it doesn't work. It returns an error:
AttributeError: 'Worksheet' object has no attribute 'merge_cells'
(according to pygsheets reference it should have it)