I'm trying to create an excel file and try to open it and perform some operations on that data.
file_path = 'd:/files/'
file_folder = 'new_files'
file_name = 'sample.xlsx'
def export(data):
data.to_excel("{}/{}".format(downloadpath(), downloadfile()), index=False)
excel_data = open("{}/{}".format(downloadpath(), downloadfile()), 'rb')
# excel_data_operations
def downloadpath():
PATH = os.path.join(file_path, file_folder)
if not os.path.isdir(PATH):
return os.makedirs(PATH)
return PATH
def downloadfile():
return file_name
I'm trying to do this, but getting end up with
FileNotFoundError: [Errno 2] No such file or directory: 'None/sample.xlsx'