CSV and VCF import support

Do we have support for importing CSV and VCF files? Do we get Nextcloud integration?

VCF … yes. I think sudo apt install librem5-goodies and you will get Contacts Importer. I’m still working on my contacts and so haven’t tried it yet.


I’m so close to ditching Android altogether


SailfishOS meets my needs and wants-mostly…

But the Librem 5 gives me quite a bit more to mess with…

But to we get Nextcloud integration?

For CSV, I would suppose that it is never trivially possible because there is no standard for representing contact information in CSV. So you are left with two options:

  • a decent GUI for specifying a mapping from CSV columns to something more standard (which becomes a non-trivial exercise unless someone has already done it), OR
  • you write a quick and dirty awk script (or similar) to convert CSV to VCF

I would look at the second option.

1 Like

Well, that solves one thing, but I am building a Nextcloud server for email, backups, contact syncing, etc.

For Nextcloud … it’s not something that I am doing but “search” is your friend. There are several topics on Nextcloud as it relates to the Librem 5. Maybe not current.

1 Like

The average person probably has only up to a few hundred personal contacts. I would guess that some individuals have maybe as many as a thousand personal contacts. If you run a small business, maybe ten thousand contacts. But for most of us, it’s probably more like less than two hundred.

If you can get these contacts exported from where ever they are in to CSV format, then you can do whatever you want with them, quite easily. It may take a half-hour or so to manually move the information around by hand in CSV format in Excel. But being a one-time thing, that is no big deal. Even though I am good at writing Excel macros, I would format the data manually because it’ll take a half-hour (at least) any way, to write the macro. So with only a few hundred contacts, I might just as well do it manually and thus, have the opportunity to cull old data and update new data as I go.

If you have more than just a few hundred contacts, you’ll need to be sure that your source data is formatted consistently. Automated data formatting won’t fix human errors. This would be a good time to learn how to use Excel macros.

1.) Enable Ms-Excel macros in Excel and make sure your PC will trust Excel macros.
2.) Open Excel Macros and select “Record New Macro”. Do a few things and then stop recording. Then go back in and run what has been recorded. Excel should then repeat what you have recorded, thus doing again, what you did yourself, while recording. But it will do those actions on its own. At this point, you have written, recorded, and replayed an Excel Macro. Get comfortable with how this works before going to the next step.
3.) Go back in to the Excel Macro area and select your recording and click on “Edit”. Here you will see the code that runs when you execute your code. Now create a new macro that selects a cell to do something to, such as to cell “C5”. Go back and edit that macro as follows. Change the “C5” to “C” & X (that exact syntax). Then right before that line, put “For X =5 to 10” (but don’t use the quotation marks). Then below your “C” & X line put “Next X” without the quotation marks. When you execute this, whatever was supposed to happen to C5, will happen also to C6 through C10.
4.) Create a new macro by recording yourself manually copying the contact data for only one contact, manually from one Excel spreadsheet to another, putting the data in to the new spreadsheet in the new format. Then edit the macro to replace the X with the names of applicable variables. By the time you learn how to manage loops and variables, you will know how to build your own translation macro, from any data format to any data format. It’s easier than it may appear at first.

What is this thing called Excel? :wink: Are you assuming that everyone runs Microsoft Windows?

However for those that do, I’m sure those instructions will be helpful.

Yes to both of these. It’s an opportunity for culling and data cleansing, no matter how you do the import.

If you’re going to be using any nextcloud for contacts, skip using Kyle’s (fine) contact importer, as your nextcloud contacts will show up when you get the nextcloud connection established. I used nextcloud’s web interface to import my contacts.vcf.

For years now I’ve been doing something similar in vi (actually vim), whenever I have to do an action repeated across many different records. It can be a wondrous time saver and maybe even amaze your coworkers that you can make changes so fast.

  1. First, in your .exrc, add the line " map ^O @a ". (That’s a control-O that can be typed with ^V^O .) I remember that keystroke as the mnemonic “operate”. Leave that there indefinitely.
  2. Start vi on the textfile you need to modify, & position to the first start of the line of the first record to be modified.
  3. Hit qa to start dynamically recording to the buffer named “a”.
  4. Make the necessary changes to the line, ensuring that positioning reflects the requirement. E.g., if you need to swap the 3rd & 4th fields in a csv, you might position to the start of the 3rd field with “2f,l”, then delete through the 3rd field with “df,”, then move to the end of the former 4th field with “f,”, then re-insert the former 3rd field with “p”. You likely DON’T want to just move around within the record with “l” and “w”, as content often varies per record. Stick to the requirement.
  5. Move to the next record with “j” (or perhaps to a “/search”), and move to the beginning of the line with “0”. Then hit “q” to terminate the recording to the buffer named “a”.
  6. Hit ^O once to run the macro on this next record. If no error occurs, visually verify it worked as desired, but if you move your cursor to do so, make sure to put it back where it was.
  7. Hit ^O two or three more times, and verify the changes are correct.
  8. Once confidence is built, you can hold down ^O to blast through the end of the file.
  9. Save to a different filename, & have someone else verify the changes are correct.
  10. Bask in the accolades.

What’s above sounds more complicated than it actually is. Once you get practiced at it, the changes can be quite complex.

1 Like

Are you 100% sure that it does not phone “home” all your contacts?

1 Like

Nextcloud is FOSS, I sure hope it’s not, and I will block outbound requests for anything I feel is fishy)…

I think @guru was responding to the recommendation of “CSV to VCF Converter Software”. It’s probably Windows-only anyway, which makes it useless to me.

Hypothetically, it may be safe to run it in a VM that runs Windows and has no internet access - and then dispose of the VM. That is, if it is even possible to run Windows without internet access these days.

That doesn’t address the issues that were raised though.

For those like me who struggled to find this mysterious “Contacts Importer” script. Here are the commands I used:

sudo apt install librem5-goodies
l5-contacts-importer /my/absolute/path/to/contacts.vcf

Make sure that the path given is the absolute one. Navigating to the file location and using a relative path to the contacts VCF file did not work.

1 Like

Or use the GUI instead of the second command? I admit though it was a long time ago that I imported my contacts.


Oh, yes. You’re absolutely right. Or use the GUI. That is embarrassing.

I even missed the app after you said a GUI exists, and I browsed through my apps 3 times. I guess to make this not an entirely useless comment, make sure you have “Show All Apps” on and… you read slowly?

1 Like