Skip to main content
All CollectionsImporting dataInstructions
How to modify CSV files to import them to Koinly
How to modify CSV files to import them to Koinly
Jack avatar
Written by Jack
Updated over 2 months ago

If you have a CSV file with your transactions that cannot be imported to Koinly automatically (e.g. from an exchange we don't support) you have to transform the file to a format Koinly recognizes.

This article outlines the steps needed to do this.

☝️ Don't reformat files from supported exchanges

If you downloaded the file as per our integration instructions and:

  • There's no rejection message like "this file is not needed"

  • You are asked to map the file ("Unknown file")

Then don't modify the file - instead, contact our support via chat.

1️⃣ Choose the correct template

Open your file in a spreadsheet editor of your choice (Excel, Google Sheets). Review the data structure in your file and compare it with Koinly's templates.

Select the template that best matches the data structure in your original file. Use:

🟩 Simple template if:

  • File has one "movement" of one asset per row

  • File shows your futures trades (closed PNL)

  • File contains trades but one trade spans three rows: one row for "sold", one row for "received", one row for "fee"

🟫 Trades template if:

  • File has a column with the trading pair (e.g. "ETH-USD")

  • File has a column with the direction of the trade (e.g "Buy", "Sell")

🟦 Universal template if:

  • File has separate columns for "Sent" and "Received" assets in the same line

2️⃣ Rename columns

Rename the column names (headers) in your file so that they have the exact same names as Koinly's templates.

ℹ️ Renaming the columns is usually enough

This is often the last step you need to import your file to Koinly. The notes below and step 3️⃣ are for more complicated cases only.

  • Data types in the columns need to match Koinly template

    • The values in those columns also need to match what our templates expect

    • e.g. 🟩 "Amount" needs to contain numbers, 🟫 "Pair" needs two symbols with a divider between them, etc.​

  • Leave other column names unchanged (Koinly will just ignore them)

3️⃣ Add/calculate missing columns

Sometimes our templates require columns that don't exist in your original file. If that's the case, you need to add this column and fill it with data accordingly:

  • Add "Tags" column so Koinly can apply correct tags automatically

  • Add "Currency" column and fill it with the currency

  • Adjust 🟩 "Amount" column so that it's negative for withdrawals

  • Calculate 🟫 "Total" from traded amount and unit price

This can be done manually (by editing every cell needed) or using spreadsheet formulas (more convenient if your file has a lot of rows).

We're sharing spreadsheet formulas for the most common issues below πŸ‘‡

4️⃣ Import the file to Koinly

Once all the required columns are added with correct data, save your file and import it to your wallet in Koinly πŸŽ‰

πŸ”΅ Example: Transforming a CSV with trading activity

In the example below, we transform an example file containing trades (from some exchange Koinly doesn't support) to import it to Koinly. Steps done are:

  • We Import the file to an empty Google Sheets using File > Import

  • In "Import location", we select "Replace current sheet" and click "Import data"

  • When reviewing the imported file:

    • What data does it contain: deposits and withdrawals, rewards, trades?

    • Does it look like one of Koinly's templates? Which one?

  • As this file looks like the 🟫 Trades template, we rename the matching columns

  • One column is not needed (Price) but also one column is missing (Total)

  • We use the Price and Amount columns to calculate the missing column

  • File is ready to download and import to Koinly

πŸŽ₯ Showcase: Video showing how to transform a CSV file to a koinly-readable format


✳️ Common issues

Tags are not applied

If you have a column defining the type of the transaction you can't just rename it to "Tags" - the values in the "Tags" column need to match what Koinly expects

  1. Keep the name of the original column as is

  2. Create a new column called "Tags"

  3. Use =IFS() (IFS function) to match types in the original file to Koinly's tags
    e.g.

    =IFS(B2="deposit","",B2="Bonus","reward",B2="Perp PNL","realized gain",B2="Futures fee","margin fee")

Withdrawals import as deposits

When using 🟩 Simple template, the values in the "Amount" column need to be negative if it's a withdrawal. Sometimes the amount is always positive and the direction depends on another column (e.g. "Type" column saying that it's a "deposit", "withdrawal", etc.)

  1. Keep the name of the original column as is (e.g. "Value")

  2. Create a new column called "Amount"

  3. Use =IFS() to decide if values in this column should be positive or negative
    ​
    e.g.

    =IFS(B2="deposit",C2,B2="withdraw",C2*-1)

Amount can't be zero

If you're trying to add individual (separate) fees, you cannot add them to "Fee Amount" and "Fee Currency" columns while leaving the "main" Amount column empty.

🟩 Simple template:

  • Fill "Amount" column (negative value) and "Currency" instead of "Fee (..)" columns

  • Fill "Tag" column with cost

🟦 Universal template:

  • Fill "Sent Amount" and "Sent Currency" columns instead of "Fee (...)" columns

  • Fill "Tag" column with cost

Total is missing

Original file looks like the 🟫 Trade template but there's no "Total" column. What is present in the file is the unit price and the quantity of base asset traded

  1. Keep the name of the column with unit price as is (e.g. "Price")

  2. Add a new "Total" column

  3. Calculate this column as =quantity * unit_price,
    e.g.

    =D2*E2

Pair is in two columns

Original file looks like the 🟫 Trade template but base and currency are in two separately columns.

  1. Keep original columns as they are (e.g. "Base Currency" and "Quote Currency")

  2. Add a new "Pair" column

  3. Calculate this column as =base &"-"& quote
    e.g.

    =B2&+"-"&C2

Amount and currency in one column

If the amount and currency are in the same cell together (e.g. 100.32 USDT in one cell) you can:

  1. Add one empty column to the right

  2. Use "Text to columns" using space as delimeter

Alternatively:

  1. Add two new columns

  2. Use =LEFT() and =FIND() to get the amount

  3. Use =RIGHT(), =LEN() and =FIND() to get the currency
    e.g.

    =RIGHT(B2,LEN(B2)-FIND(" ",B2))

Pair doesn't have a divider

If the pair in the file is provided without a divider (e.g. ETHBTC instead of ETH-BTC or ETH/BTC) it's impossible to automatically identify the pairs without knowing all the pairs traded on the exchange (e.g. BTTUSD can be either BT-TUSD or BTT-USD). That's why the divider needs to be added to the Pair column in our 🟫 Trades template.

There's no simple solution to this as symbols have varying lengths (number of letters).

  • A certain solution is to add a new column with =IFS() but if you traded a lot of pairs, this could become a tiresome, long formula

  • If most trading pairs have the same quote asset, then search&replace usually fixes a majority of pairs and whatever's left can be fixed manually

Everything in one column

When you open the file in Excel/Google Sheet, everything is added in one column with one long line of text in each row. That means that the delimiter used in the file is different than what your regional settings expect.

You can use "Text to column" to recreate columns but most likely you'll have the issue with number formats so might be better to use the solution in Numbers are thousandfold

Numbers are scrambled

When you open the file in Google Sheets, all numbers are wrong - often show amounts a thousand times larger than they should be. This is not an issue with the data but how the data in the file is processed - commas or dots in the amount are misinterpreted.

  1. Open a new empty sheet in Google Sheet

  2. Go to File > Settings

  3. Change the locale. It's hard to say what's the correct one, but usually one these will work: either United States, United Kingdom, or Germany

  4. After that, go to File > Import

  5. Upload your CSV file

  6. In the next popup, in "Import location" select "Replace current sheet"

  7. Click "Import file"

  8. If the numbers are still scrambled then the locale is wrong

This is easier to fix in Google Sheets than in Excel because Google Sheets has per-file locale. For Excel, you would need to change the locale in your OS settings.


Did this answer your question?