Last active
September 18, 2022 15:32
-
-
Save asmega/b30ecd554adaf2e1c10a39ad7b15a3d1 to your computer and use it in GitHub Desktop.
ticktick csv export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "csv" | |
require "pry" | |
rows = CSV.read("./ticktick.csv", headers: true) | |
rows = rows.select { |row| row["Completed Time"].nil? } | |
CSV.open("./ticktick2.csv", "w") do |csv| | |
csv << rows[0].headers | |
rows.each do |row| | |
csv << row.fields | |
end | |
end | |
hash = {} | |
rows.each do |row| | |
hash[row["List Name"]] ||= [] | |
hash[row["List Name"]] << "#{row['Title']} #{row['Content']}" | |
end | |
hash.each do |key,v| | |
CSV.open("./tick-#{key.gsub(' ', '-')}.csv", "w") do |csv| | |
v.each do |item| | |
csv << [item] | |
end | |
end | |
end | |
# binding.pry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment