{
  "id": 15292718,
  "title": "Writing a transaction CSV that Google Sheets imports correctly: locale, decimals and formula injection",
  "url": "https://urgent.news/2026/10/17/writing-a-transaction-csv-that-google-sheets-imports-correctly-locale",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-17T22:26:31.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/zerabooks/writing-a-transaction-csv-that-google-sheets-imports-correctly-locale-decimals-and-formula-1496"
  },
  "original_language": "en",
  "account": "To create a transaction CSV that Google Sheets imports correctly, you need to follow four key rules: quote fields according to RFC 4180, write amounts as plain numbers with two decimal places and no thousands separator, use a single documented date format, and neutralize text cells that begin with a formula character. If any of these rules are not followed, Google Sheets will silently reinterpret the file.\n\nFor amounts, write them as plain numbers with two decimal places and no thousands separator. For instance, use 1234.56 instead of 1,234.56. This is crucial because amounts are typically written with a minus sign for money out; parentheses are not used for negatives in a CSV file as Sheets may misinterpret them as text.\n\nDates in Google Sheets are tricky. The correct format is 2026-03-02, which is the least ambiguous across all locales. However, many accounting imports expect MM/DD/YYYY. If you choose to use this format, make sure to document it clearly in your CSV and instruct users to adjust their locale settings before importing. A common mistake with dates is that different locales interpret 03/02/2026 differently; for example, it could be March 2 in the U.S. or 3 February in the U.K.\n\nWhen quoting a bank CSV, rely on the CSV library to handle quotations. The Python csv module can be used to write rows safely, with QUOTE_MINIMAL, which adds quotes only when necessary and handles inner quotes by doubling them. This prevents issues with commas within bank descriptions or payees.\n\nTo stop CSV formula injection, which can cause problems when a user attempts to import data with formulas, prefix any text that starts with a formula character (like \"=\" or \"+\") with an apostrophe. This tells Google Sheets to treat the cell as text rather than a formula. Always treat bank descriptions as user input, as they are often written by the payer and may contain unwanted characters.\n\nA clean sample CSV should have the following format: Date,Description,Amount. For example:\nDate,Description,Amount\n03/02/2026,DEPOSIT CLIENT INV 1042,4000.00\n03/03/2026,RENT MARCH,-2400.00\n03/31/2026,INSURANCE PREMIUM, POLICY 8812,-174.95\n\nAfter importing, users can verify that the import was complete by checking if the closing balance equals the sum of the opening balance, the sum of all amounts (deposits are positive, withdrawals are negative), and minus the closing balance. If the result is not zero, it indicates that something did not import correctly, such as a missing deposit or an amount written as text instead of a number.",
  "summary": "To write a transaction CSV that Google Sheets imports cleanly, follow four rules : quote per RFC 4180, write amounts as plain numbers with two decimals and no thousands separator , use one documented date format, and neutralise text cells that start with a formula character. Break any of them and Sheets silently reinterprets the file. If your app exports bank transactions, a good share of users…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}