[Solved] Selecting columns containing multiple keywords
[Solved] Selecting columns containing multiple keywords
Hi! Absolute beginner here... I have TONS of spredsheets containing metadata from tons of files, documents, images, videos, mp3s. Each sheet has hundreds of columns. I need only the columns containing FileName, FileSize, CreateDate, Resolution, FileType, PageCount, Bitrate and a few more.
I found a macro to delete specific columns, based on the column letter, but the problem is that in one sheet the FileName is in column B, in an other sheet it can be in D or Z or anywhere. Is there a macro or filter I can apply to keep only the columns containing specific text (FileName, FileSize, CreateDate, Resolution, FileType, PageCount, Bitrate), or to copy these columns to a new spreadsheet?
How would you aproach this? Thank you!
I found a macro to delete specific columns, based on the column letter, but the problem is that in one sheet the FileName is in column B, in an other sheet it can be in D or Z or anywhere. Is there a macro or filter I can apply to keep only the columns containing specific text (FileName, FileSize, CreateDate, Resolution, FileType, PageCount, Bitrate), or to copy these columns to a new spreadsheet?
How would you aproach this? Thank you!
Last edited by Hagar Delest on Tue Jan 26, 2021 6:28 pm, edited 1 time in total.
Reason: tagged solved.
Reason: tagged solved.
OpenOffice4.1, Windows 10
Re: Selecting columns containing multiple keywords
Welcome to the Forums.
I'd start by using a better app, namely a database, rather than a spreadsheet.
I'd start by using a better app, namely a database, rather than a spreadsheet.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
- MrProgrammer
- Moderator
- Posts: 5283
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Selecting columns containing multiple keywords
Hi, and welcome to the forum.
[Tutorial] Sorting and Filtering data with formulas
Or was it actually imported into Calc from some external source? Which external source, very specifically? CSV files? Some damned Windows resource? Which resource, specifically? A database? Which database, specifically? Why do you not give us the full details about your problem?
[Tutorial] Ten concepts that every Calc user should knowbanathy wrote:Absolute beginner here
You can copy them to a new sheet with a filter.banathy wrote:Is there a macro or filter I can apply to keep only the columns containing specific text (FileName, FileSize, CreateDate, Resolution, FileType, PageCount, Bitrate), or to copy these columns to a new spreadsheet?
[Tutorial] Sorting and Filtering data with formulas
Did you type these megabytes of data yourself into Calc? If so, why did you enter a lot of data which you do not want?banathy wrote:I have TONS of [spreadsheets] containing metadata from tons of files, documents, images, videos, mp3s. Each sheet has hundreds of columns. … I need only the columns containing …
Or was it actually imported into Calc from some external source? Which external source, very specifically? CSV files? Some damned Windows resource? Which resource, specifically? A database? Which database, specifically? Why do you not give us the full details about your problem?
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Selecting columns containing multiple keywords
Thank you! 
I have 4 TB worth of unsorted e-books, documents, images, videos, sound files in my university's library. Basically 20 years of bad data management. Now they want to catalogue all of them. Yesterday I managed to pull out all the metadata from every file from a single folder into a csv file. I had lots of csv files containing a lot of irrelevant tags in columns and I was trying to put all the columns I need into a single sheet and get rid of the rest. Today I figured it out how to pull out only the relevant metadata tags from the files and I generated new csv-s. Now I have to figure out, how to merge the csv files, and how to enter each file's filepath. I've never done anything of the sorts in my life, so I'm making it up as I go

I have 4 TB worth of unsorted e-books, documents, images, videos, sound files in my university's library. Basically 20 years of bad data management. Now they want to catalogue all of them. Yesterday I managed to pull out all the metadata from every file from a single folder into a csv file. I had lots of csv files containing a lot of irrelevant tags in columns and I was trying to put all the columns I need into a single sheet and get rid of the rest. Today I figured it out how to pull out only the relevant metadata tags from the files and I generated new csv-s. Now I have to figure out, how to merge the csv files, and how to enter each file's filepath. I've never done anything of the sorts in my life, so I'm making it up as I go

OpenOffice4.1, Windows 10
Re: [Solved] Selecting columns containing multiple keywords
Once you get a bit of the mess tidied up you really need to look into something like a data base or the same mess will happen again.
LibreOffice 7.3.7. 2; Ubuntu 22.04
Re: [Solved] Selecting columns containing multiple keywords
Make sure that the data structure of all the files you wish to combine is identical, otherwise you will have issues! Give all the files you wish to merge a common filename suffix, e.g. .csv and place them in the same directory. Navigate to that directory with file manager and open a command widow via right click. Then just issue the commandhow to merge the csv files
Code: Select all
copy *.csv merged.csv
You'll need to copy/paste the URL as the parentheses in it break the automatic link creation.
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 25.2.4.3; SlackBuild for 25.2.4 by Eric Hameleers
---------------------
Apache OpenOffice 4.1.15
LibreOffice 25.2.4.3; SlackBuild for 25.2.4 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue]
Unexpected '{' on line 32
.Re: [Solved] Selecting columns containing multiple keywords
Thank you so much, guys!
I'm almost done generating the csv-s for ALL folders. Hundreds and hundreds. Yeah, it is a nightmare. Exiftool doesn't likes folder names with spaces, so I have to rename them, run Exiftool then I have to revert to the original name. The csv file doesn't contain the full file path, just the (renamed) folder's name. So I will run find/replace to find the folder name and replace it with the full path. Afterwards I will try to merge the csv-s. Luckily the data structure is the same in all of them but my spider sense is tingling about the different special characters in the metadata. Hungarian, Turkish, Sanskrit... Oh well, we'll see.
My name is Attila and I will be an alcoholic.
I'm almost done generating the csv-s for ALL folders. Hundreds and hundreds. Yeah, it is a nightmare. Exiftool doesn't likes folder names with spaces, so I have to rename them, run Exiftool then I have to revert to the original name. The csv file doesn't contain the full file path, just the (renamed) folder's name. So I will run find/replace to find the folder name and replace it with the full path. Afterwards I will try to merge the csv-s. Luckily the data structure is the same in all of them but my spider sense is tingling about the different special characters in the metadata. Hungarian, Turkish, Sanskrit... Oh well, we'll see.
My name is Attila and I will be an alcoholic.
OpenOffice4.1, Windows 10
Re: [Solved] Selecting columns containing multiple keywords
I always liked working with Sam Francke's CSVed when dealing with *.csv
https://csved.sjfrancke.nl/index.html
https://csved.sjfrancke.nl/index.html
____________
DiGro
AOO 4.1.15 (Dutch) on Windows 11. Scanned with Ziggo Safe Online (F-Secure)
DiGro
AOO 4.1.15 (Dutch) on Windows 11. Scanned with Ziggo Safe Online (F-Secure)
-
- Posts: 335
- Joined: Sun Sep 06, 2020 8:27 am
Re: [Solved] Selecting columns containing multiple keywords
It may be to late for your case, but Exiftool accepts quoted filenames and in my case i used the recursive scan of all subfolders - no Problem with spaces here.banathy wrote:Thank you so much, guys!
I'm almost done generating the csv-s for ALL folders. Hundreds and hundreds. Yeah, it is a nightmare. Exiftool doesn't likes folder names with spaces, so I have to rename them, run Exiftool then I have to revert to the original name. The csv file doesn't contain the full file path, just the (renamed) folder's name. ...
As I remember ther are names for filename and path, so your workaround shouldn't be necessary.
If you are interested I can find and post my script to access the collection of 80000 photos 4 photographers left behind in my archive at work...
J.
LibreOffice 7.6 on Windows 10pro and other Versions parallel
Re: [Solved] Selecting columns containing multiple keywords
Oh, it is definitely not to late, there are several other hard drives I haven't even touched yet... It would be amazing to see your solution. I started to suspect there may be a solution like this, but I never worked with spreadsheets or code or Exiftool before last week, all of this is pretty new to me.It may be to late for your case, but Exiftool accepts quoted filenames and in my case i used the recursive scan of all subfolders - no Problem with spaces here.
As I remember ther are names for filename and path, so your workaround shouldn't be necessary.
If you are interested I can find and post my script to access the collection of 80000 photos 4 photographers left behind in my archive at work...
OpenOffice4.1, Windows 10
-
- Posts: 335
- Joined: Sun Sep 06, 2020 8:27 am
Re: [Solved] Selecting columns containing multiple keywords
Code: Select all
@echo off
REM Extracts Exif-Tags for all Files in an Directory given as Argument to csv-File
REM !! -r = recursive scan / omitt, if necessary
IF NOT EXIST P:\ExifTool\ GOTO NOPORT
P:
cd p:\ExifTool\
Echo Scan of %1
exiftool.exe -r -csv -SourceFile -FileName -DateTimeOriginal -Model -ImageWidth -ImageHeight -Orientation -PhotometricInterpretation -Keywords %1 >%1\_EXIFData.csv
goto ENDE
:NOPORT
echo "Portable P:ExifTool missing"
goto :ENDE
:ENDE
pause
exit
Exiftool:
-r recursion
-csv output as csv file
SourceFile give the full path, filename only the name with extension
the other parameters select EXIF-Data I needed for this run
%1 >%1\_EXIFData.csv scans the given directory, output is directed to the named File in the directory; % is Windows Batch - adapt for bash
In a separate batch I collect/append all csv-Files and import them afterwards to a sqlite database.
It is also possible to register the resulting csv as Text-Database in AOO/LO-Base for direct access or simple queries,
but a real SQL-database is much more flexible and trustworthy.
(Edit: Early version to access csv as Text-Database from a german forum: https://www.libreoffice-forum.de/viewto ... XIF#p41302 )
J.
LibreOffice 7.6 on Windows 10pro and other Versions parallel