
Announcements
Hi Everybody,
I'm trying convent the txt file with separator "fixed column widths", but that have error message when i run the flow, please help and thank you in advance.
Error message:
Import failed. Error while parsing
Error details.
Line 10 cannot be parsed using the current FieldWidths.: Robin.Core.ActionException: Import failed. Error while parsing ---> Microsoft.VisualBasic.FileIO.MalformedLineException: Line 10 cannot be parsed using the current FieldWidths.
at Microsoft.VisualBasic.FileIO.TextFieldParser.ValidateFixedWidthLine(StringInfo Line, Int64 LineNumber)
at Microsoft.VisualBasic.FileIO.TextFieldParser.ParseFixedWidthLine()
at Microsoft.VisualBasic.FileIO.TextFieldParser.ReadFields()
at Robin.Modules.File.Actions.FileActions.ReadFieldsEnhanced(TextFieldParser parser)
at Robin.Modules.File.Actions.FileActions.ImportCSVResource(Variant csvFilepath, Variant rawCsvText, Variant customColumnsSeparator, Variant fixedColumnWidths, Variant& csvTable, Int32 csvSourceMode, Int32 csvFileEncoding, Int32 separatorType, Boolean trimFields, Boolean firstLineContainsColumnsNames)
--- End of inner exception stack trace ---
at Robin.Modules.File.Actions.ReadFromCSVFile.Execute(ActionContext context)
at Robin.Runtime.Engine.ActionRunner.RunAction(String action, Dictionary`2 inputArguments, Dictionary`2 outputArguments, IActionStatement statement)
Does your file have 10 lines? Perhaps there's a newline at the end with a blank line that makes it fail?
If so, you can try using Read text from file to get the file contents as a single blob of text. Then use Trim text to trim it and then use Write text to file to write it back as a plain text.
Once you've done this pre-processing, you can try reading it as a CSV file with fixed column lengths again.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.