Dataframe save into excel using xlwings

Viewed 42

While i am saving my dataframe into excel using xlwings i am getting below error.

enter image description here

Below is my code .

app = xw.App()
app.display_alerts = False

#Template Open
wb = xw.Book(template)
sht = wb.sheets["Flash"]
sht.range('A2').options(index=False,header=False).value = df #copy the dataframes
wb.api.RefreshAll()
wb.save(xl)
wb.close()
app.quit()
xw.apps

Traceback :

Traceback (most recent call last):
  File "C:\Users\RAVINDRA.K\OneDrive - KPK FASERV INDIA PVT LTD\My Projects\IMEi\IMEI FLASH WH WISE.py", line 441, in <module>
    sht.range('A2').options(index=False,header=False).value = df #copy the dataframes
  File "C:\Program Files\Python39\lib\site-packages\xlwings\main.py", line 1803, in value
    conversion.write(data, self, self._options)
  File "C:\Program Files\Python39\lib\site-packages\xlwings\conversion\__init__.py", line 48, in write
    pipeline(ctx)
  File "C:\Program Files\Python39\lib\site-packages\xlwings\conversion\framework.py", line 66, in __call__
    stage(*args, **kwargs)
  File "C:\Program Files\Python39\lib\site-packages\xlwings\conversion\standard.py", line 74, in __call__
    self._write_value(ctx.range, ctx.value, scalar)
  File "C:\Program Files\Python39\lib\site-packages\xlwings\conversion\standard.py", line 62, in _write_value
    rng.raw_value = value
  File "C:\Program Files\Python39\lib\site-packages\xlwings\main.py", line 1399, in raw_value
    self.impl.raw_value = data
  File "C:\Program Files\Python39\lib\site-packages\xlwings\_xlwindows.py", line 808, in raw_value
    self.xl.Value = data
  File "C:\Program Files\Python39\lib\site-packages\xlwings\_xlwindows.py", line 103, in __setattr__
    return setattr(self._inner, key, value)
  File "C:\Program Files\Python39\lib\site-packages\win32com\client\__init__.py", line 482, in __setattr__
    self._oleobj_.Invoke(*(args + (value,) + defArgs))
OverflowError: int too big to convert
0 Answers
Related