Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Batch Macro - convert xlsx to csv shows empty rows at end of csv file

stapuff
9 - Comet

I ran into something I have not seen before and looking to see if anyone has solved this or suggested solutions.

 

I have a batch macro that pulls Excel xlsx files from a Directory and simply converts them to csv, renames them and places them in a different folder. There is no additional data manipulation happening. All of this works as it should.

 

The xlsx files are not structurally the same so I can not reference a specific Column Name in like a formula.  

 

Empty rows are being output at the end of the csv as ,,,,,

I am not "seeing" any empty rows at the end of the xlsx files so I have no idea where they are coming from.

Also checked to see if any of the rows had spaces.

 

"The only idea I can come up with is save xlsx as a csv... re-read in the csv and then check for ,,,"

 

Note - I don't think this will work either since I wouldn't know the column names from a csv either. In addition... thought about using field info tool, but some of the xlsx have empty first rows.

 

 

Your thoughts.

 

Thanks,

 

Puff

 

 

12 REPLIES 12
danilang
19 - Altair
19 - Altair

Hi @stapuff 

 

As well as @DavidP's suggestion about filtering it out, you may want to remove the corresponding file without the ~ as well.  Your process won't be able to open it since it's locked.  Depending on how the rest of your workflow is structured, this could cause the entire thing to fail.  Send an email or otherwise notify the user that the data may not be valid because of the missing file.

 

Dan

stapuff
9 - Comet

@danilang @DavidP 

Excellent advice. Was thinking on the same lines.

Any suggestions on a quick and clean way to remove both file references at the same time? I have already added a formula tool just before the batch macro to test  if file exists run if not end. 

 

Puff

DavidP
17 - Castor
17 - Castor

Something like this

 

DavidP_0-1587071166795.png

 

Labels
Top Solution Authors