Question about CSV files

BDGibson4

New Member
Joined
Jun 8, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Is there any way to compensate (without using any VBA) for blank cells?

The files I am creating need to be in an Excel.csv format. The issue is the top row only has data in A1. The rest are B1:{varies}5. When importing this into a separate system (that I do not control) this leaves A2:A5 as ,,,,

This will be compounded in some instances where after the main data set there is a blank row followed by another set of data of similar structure.

Unfortunately the receiving device requires this very specific formatting.

I understand that is how .csv is suppose to work, but is there a simple way to add constraint onto the actual data so this does not occur?

Thank you in advance,
Cody
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Welcome to the Board!

The files I am creating need to be in an Excel.csv format
Note that Excel and CSV are two different, distinct file formats (there is no "Excel CSV" format, there is an "Excel" format, and a "CSV" format).

Unfortunately, I do not know of any way to do what you want without some sort of scripting, whether that is VBA or or some other code outside of Excel.
When you save from an Excel file to a CSV file, every row will have the same number of columns (fields), which will always be the length of the longest row in your Excel file.
I don't know of any way to get around that default behavior, unless you do it in pieces manually.

I did something like that years ago, where I had to create text files from Excel that had different header and trailer rows from the rest of the data.
I did that by copying just my header row to a new tab, and saving that as one text file.
Then I copied all my data to another tab, and saved that as another text file.
Lastly, I copied my trailer row to a third tab, and saved that as my last text file.
Then I used some VBScript to combine all three files into one.
 
Upvote 0
I agree with @Joe4 . You need VBA to create the file, or you need to use a text editor or other scripting language to edit the resulting .csv file.
 
Upvote 0

Forum statistics

Threads
1,215,781
Messages
6,126,869
Members
449,345
Latest member
CharlieDP

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top