M J
M J

Reputation: 379

Unable to save excel workbook on mac using xlwings

I'm running the same Xlwings code with jupyter notebook on both MAC and Windows to save a new Excel workbook in a folder.

import xlwings as xw
import os

wb = xw.Book()
wb.save(os.path.join(os.getcwd(),r'pro/fi/g.xlsx'))
wb.close()

It runs on Windows fine but gives the following error on MAC;

CommandError: Command failed:
                OSERROR: -50
                MESSAGE: Parameter error.
                COMMAND: app (pid=71190). workbooks [ 'Book2'].save_workbook_as (filename='Macintosh HD: Users: mohit: Desktop: pro:fi:g.xlsx', overwrite=True, file_format=k.Excel_XML_file_format, timeout=-1, password=None)

Upvotes: 1

Views: 246

Answers (1)

tejo
tejo

Reputation: 33

I've experienced the same issue and I noticed that was because I chose One Drive folder to save the file.

When I chose a folder outside One Drive the problem disappear.

Well, at the first instance the excel ask me to grant permission to save a file in the folder. But it saves without a problem on the subsequent safes.

Upvotes: 0

Related Questions