Exporting CSV with different number of columns in rows

You can reimport the file using the “Import plain text” action, remove the trailing commas, and then export the result back using the “Export plain text” action.

If the number of commas differs from row to row, you can use the technique described here: Treat consecutive delimiters as one