Hi @binuacs
I am creating workflow to be running in Alteryx PROD Server, I have two .xlsx files which cant read by Alteryx showing this error "Corrupt File: XML parse failure - cell has no column definition".
I know the work around would be manually opening and resaving again, but in my case user wants Alteryx should do it by automation.
Any work around for this please? This has been pending for more than a month.
Thanks in advance.
@https://community.alteryx.com/t5/user/viewprofilepage/user-id/194502
I have written this script to copy, open and resave the file using Macro, but I still get the XML parse errors, not sure if this python script does resaving the excel file or not.
from ayx import Alteryx
from pathlib import Path
import shutil
#import openpyxl
import xlwings as xw
df=Alteryx.read('#1')
df['Status']=""
length = len(df)
for i in range(length):
src=Path(df['Source Full Path'][i])
dst=Path(df['Destination Full Path'][i])
save=df['Save'][i]
#print(dst)
#print(src)
try:
shutil.copy2(src,dst)
if save=='YES':
app=xw.App(visible=False)
book=app.books.open(dst)
#wBook=openpyxl.load_workbook(dst)
#wSheet = wBook.worksheets[0]
#wSheet.column_dimensions['A'].hidden = True
#wSheet.column_dimensions['A'].hidden = False
#wBook.calculation.calcMode = 'auto'
#wBook.save(dst)
#wBook.close(dst)
book.sheets[0]['AAA1'].value = 'xlwings'
book.sheets[0]['AAA1'].value = ''
book.save()
book.close()
app.quit()
df['Status'][i]='Success'
except:
df['Status'][i]="Fails"
md = Alteryx.readMetadata('#1')
md['new_column'] = {
'name': 'Status',
'type': 'String',
'length': (15,)
}
#################################
# write out the data with the original metadata
Alteryx.write(df, 1, md)