Can I make a tabbed worksheet from a csv source file

PhilDesanex

New Member
Joined
Feb 4, 2016
Messages
8
I'm in the UK and am trying to interface our database system with Excel in order to comply with some new tax legislation (MTD - Making Tax Digital). What I want to do is make an excel file with 3 worksheets - Income, Expenditure and Analysis. I can generate all of the data in three separate csv files (although I use ~ as a list separator) and import them successfully into Excel. Is it possible to put code into the csv file that Excel would interpret and create a new tab? In this way, I could generate a complete Excel in one go, rather than combining 3 Excel sheets into one.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
CSV files are a type of text file (a "flat" text file, meaning you cannot have multiple sheets), with no formatting.
They are strictly flat data files with nothing else in them. So you are not going to be able to put VBA code in a CSV file.

I am not sure I understand the need for that anyway. You should be able to create an Excel macro that can pickup and combine all 3 CSV files into your one file all at once.
I have created many Excel Macro files that look in a certain folder for files, import them into a file, and save however you need.
Even if you have the VBA code open each CSV into separate files (instead of importing them all into one), you can simply copy/paste their contents all into one file.
 
Upvote 0
Thanks Joe. I'm doing the combine thing at the moment but just thought that someone might have developed a workaround, possibly including some custom delimiters in the csv data.
 
Upvote 0
Have look here, which shows you various methods you can use, and being able to specify the exact delimiter:

Also note that for the non-VBA options shown there, you may be able to convert it to VBA code by turning on your Macro Recorder while performing the steps manually to get most of the VBA code you need for that part.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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