Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
require 'csv'
import_file = "./keepass-export.csv"
export_file = "./passwordstate-import.csv"
headers = "Title,UserName,Description,Notes,URL,Password,ExpiryDate,WebUser_ID,WebPassword_ID,\n"
keepass_headers = ['Group', 'Title', 'Username', 'Password', 'URL', 'Notes']
rows = headers
CSV.foreach(import_file, headers: true) do |row|
this_row = [ row[1], row[2], '', row[5], row[4], row[3], '', '', ''].to_csv
rows << this_row
end
File.open(export_file, 'w') { |file| file.write(rows) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.