I am trying to create a cash flow report which should summarize the transactions made in several bank accounts. Every bank account has a separate tab and a different layout. In order to create a pivot table, I need to combine all the tabs into one tab with a unified layout and also extract the tab name. I'd like the data to be sorted in a table with the following columns/headers - Date; Amount; Category; Reference; Tab (sheet) Name The table should be sorted by date
Is it possible? How would you recommend doing it?
Here is a link to the sample file - https://docs.google.com/spreadsheets/d/10dXvOIr4vcL6M2UARUxfi88QKDaBCREuW5ca4kOqpQE/edit?usp=sharing
Any help would be greatly appreciated, thanks
I tried using a query function but managed only to combine each column separately so the columns received were not synched.
I believe your goal is as follows.
Date,Amount,Category,Reference,Tab (sheet) NameIn order to correctly understand your situation by other users, when I saw your provided Spreadsheet, the headers of "Account 1", "Account 2", and "Account 3" as follows.
["Date","BA","Internal Voucher number","Voucher number","GKonto","Amount","Haben","StS","Ausziff.Nr.","Reference","Catagory",""]["Book date","Value date","Name","Booking text","Purpose of use","Betrag","Catagory"]["Date","Amount","Reference","Catagory"]In this case, for example, the following issues are existing.
Categoryheader title. But, the actual sheet hasCatagory. Is this a spelling mistake?When a sample script for achieving your goal by including these issues, how about the following sample script?
Sample script:
Please copy and paste the following script to the script editor of your provided Google Spreadsheet, and, save the script.
myFunction, a new sheet ofnewSheetis created and the result values are put intonewSheet.Testing:
When this script is run with your provided Spreadsheet, the following result is obtained in
newSheet.Note:
From your expected header titles and the header titles in your provided Spreadsheet, I prepared an object (
adjustHeaderTitles) for searching the header titles. This object is to your provided Spreadsheet. So, if your actual situation is different from the following values, please modify it.I supposed that "Book date" of "Account 2" sheet is as "Date". If you want to use "Value date" as "Date", please modify
"Book date": "Date"to"Value date": "Date".This sample script is for your provided Spreadsheet. When I tested my script using your provided Spreadsheet, no error occurs. So, please test this script to your provided Spreadsheet. If you change the Spreadsheet, the script might not be able to be used. Please be careful about this.
References: