Multiple spreadsheet into a single spreadseet
Multiple spreadsheet into a single spreadseet
Author
Discussion

98elise

Original Poster:

32,915 posts

192 months

Wednesday 30th May 2018
quotequote all
Is there a quick way of pulling multiple spreadsheets into a single sheet?

I have some data collated in about 400 spreadsheets which I want to manipulate in bulk.

They are all single sheet and the same format so just need appending one after the other.

cat with a hat

1,488 posts

149 months

Wednesday 30th May 2018
quotequote all
How many rows are we talking? And any reason you don't want to use a database?

98elise

Original Poster:

32,915 posts

192 months

Wednesday 30th May 2018
quotequote all
cat with a hat said:
How many rows are we talking? And any reason you don't want to use a database?
I would love to use a proper database, but this is 400 spreadsheet I've inherited, and I need to identify some particular data. The spreadsheets are essentially forms (header section with a table below)

If I can get them into one big sheet as I can order the rows to highlight the data. Then return it to its original order which will maintain the form


WinstonWolf

72,863 posts

270 months

Wednesday 30th May 2018
quotequote all
Quick and dirty, this might do the trick from the command line...

copy sheet1.xls + sheet2.xls newsheet.xls

Mr Pointy

13,455 posts

190 months

Wednesday 30th May 2018
quotequote all
Merging (not consolidatiing) two spreadsheets seems to be what you want to do. A quick Google turns up this add-on but it might cost you £21.95 to try it:

https://www.ablebits.com/office-addins-blog/2015/0...
https://www.ablebits.com/consolidate-worksheets-ex...

There's a 30-day money back guarantee though.

TonyRPH

13,556 posts

199 months

Wednesday 30th May 2018
quotequote all
WinstonWolf said:
Quick and dirty, this might do the trick from the command line...

copy sheet1.xls + sheet2.xls newsheet.xls
I doubt that would work because you'd need to strip the headers from the respective files.

BTW, it also needs to be 'copy /B' (for a binary file).

Solutions 4 & 5 posted here look like a possibility?



98elise

Original Poster:

32,915 posts

192 months

Thursday 31st May 2018
quotequote all
TonyRPH said:
WinstonWolf said:
Quick and dirty, this might do the trick from the command line...

copy sheet1.xls + sheet2.xls newsheet.xls
I doubt that would work because you'd need to strip the headers from the respective files.

BTW, it also needs to be 'copy /B' (for a binary file).

Solutions 4 & 5 posted here look like a possibility?
The VB solution might work. It's a work pc so I can't install other software, but VB should be possible.

P924

1,272 posts

213 months

Thursday 31st May 2018
quotequote all
Have a look at powershell.

You would need to something like

$sheets = Get-childitem c:\path\tofile\csv

Foreach $sheet in $sheets {
Import-csv $sheet | export-csv -notypeinformation -append -path c:\newfile.csv
}

obviously they'd need to be csv files.

and there will be some errors in the above, check it first please.

paulrockliffe

16,687 posts

258 months

Thursday 31st May 2018
quotequote all
You want to use VBA for this, it's fairly easy to use a Do Loop to work through every file in a selected folder and copy a range to the bottom of a new table. I have some code at work that does exactly this, but for tables that contain varying numbers of records, so uses a map, some variables and a series of nested loops to copy the records. I couldn't find any code to terminate the idiot that setup the original spreadsheets so badly.

If I remember I'll find the code tomorrow, but I pulled it together with Google, and so it can't be difficult.....