Integration with 1C using text files - Dev
Developer Guide / Integrations / Integration with 1C using text files - DevIntegration with 1C using text files (TXT, CSV) is a simple and reliable method of exchanging data between 1C:Enterprise and external systems (websites, banks, warehouse programs).
This method is based on the periodic creation or reading of files of a specific format in a shared folder or via FTP. Details on the official 1C website.
Advantages and Disadvantages
- Pros: Ease of implementation, easy debugging (the file can be opened with Notepad), independence from the 1C version, works with any configuration.
- Cons: Not suitable for real-time exchange, risk of file loss or incomplete writing during failures, difficulties in transferring complex data hierarchies.
The 1C built-in language offers two main approaches for working with text files.
1) The "ТекстовыйДокумент" object ("TextDocument"): Loads the entire file into RAM. Suitable for small files. Method: .Прочитать() (".Read()") and .Записать() (".Write()").
2) The "ЧтениеТекста" ("TextReader") and "ЗаписьТекста" ("TextWriter") objects: Used for sequential access (line by line). This is the best choice for large files, as it doesn't overload RAM.
How to implement exchange (algorithm)
- 1. Exporting data from 1C "Экспорт" ("Export"):
- The developer creates a data structure (e.g., a list of products with prices).
- Using "ЗаписьТекста" ("TextWriter", a .txt or .csv file is created, where the data is separated (e.g., by commas or tabs).
- The file is saved to the specified folder.
- 2. Loading data into 1C "Импорт" ("Import"):
- 1C reads the external file using "ЧтениеТекста" ("TextReader").
- The data is parsed row by row.
- The data is written to 1C directories or documents.
For modern integrations, it is recommended to use JSON or XML formats within text files, as they are more structured than simple CSV or TXT.
Changed: 26.04.2026 13:45


