I'm writing a batch macro to parse the scanned pdf files and to write the output for each file to a separate tab in Excel. When the macro was run, it was able to convert the files in the folder it is reading. However, I've encountered this error, Error: R (4): The field layout changed between subsequent calls to write.Alteryx with the same connection (Output1), when it was trying to output to the Excel file.
Can someone help to solve this error and let me know how to write the output for each file to a separate tab in Excel?
Solved! Go to Solution.
Did you modify settings in Interface Designer when output field changes based on configuration or data?
Can you please share me your workflow for further assistance on this?
Thanks.
@ganesamurthy , it was a standard macro and i've changed it to iteration macro when I hit the error but it still does not resolve the error. I've attached my workflow here.
Appreciate your help on this.
@ganesamurthy , thank you for your help. I've tried and still hit the same error. I'm just wondering if it is because i'm reading multiple pdf files from the folder using the macro at one go that is causing this.
Any assistance on this would be really appreciated!
Problem is you should convert this text to a dataframe in R code before bringing it to the workflow. Here is the corrected R code:
for (file in files){
pngfile <- pdftools::pdf_convert(file,dpi = 200)
text <- tesseract::ocr(pngfile)
x <- data.frame(text)
write.Alteryx(x,1)
}
Hope this resolves your problem.
@ganesamurthy , thank you so much for your help! This works.
One more question, though, is there anyway I can get the output for each file to be saved as a separate sheet in one output excel file?
This thread will help you on your query.