REFERENCE
U.READ_FILE
Summary
Reads data from the specified file into a range of cells or a cache
Syntax
Parameters
| Parameter | Required | Description |
|---|---|---|
filepath |
Yes | The path of the file to be read. If only a filename is provided, the directory of the current workbook is used. Provide as a 2-column wide range with the right cell set to FALSE to prevent use of a temporary file copy when the file cannot be read because another process has it open |
[file_type] |
No | The type of file to be read. Set to "lines" to have lines of file put in rows down a column. If set to "binary([split])" or "directory([split],[filter])" then file/dir bytes are returned as a Base64-encoded string. If set to "hash" a hex-encoded MD5 hash of file bytes is returned. Default is csv if not set. |
[null_indicator] |
No | If specified for file types containing fields, then any fields matching the specified value will be set to blank |
[do_not_parse] |
No | If set to TRUE then string fields will not be parsed into numbers, booleans and datetime values. By default values are parsed using the default logic of U.PARSE |
[cache_key] |
No | If provided, the contents of the file will be placed into a cache keyed by the provided cache key and the cache key will be returned. If set to TRUE file contents are placed in a read-once cache. Set to FALSE to return contents directly if filepath was from read-once cache |
[block] |
No | If set to TRUE then method will not be calculated unless triggered by user interaction or calculated as a step in a script. Throttling also supported. If a cache_key is provided and the cache exists, that key will be returned when the method is blocked. Provide a 2nd column here set to TRUE to return block message instead |
Behavior
The documented public interface is supported by the current U Add-in source signature and the maintained Usage Examples workbook. Optional parameters are shown in square brackets in the syntax above; omit the brackets when entering a formula.
Return Value
Returns the function result or action status described by the formula and parameters above. The maintained sources do not define a narrower, stable return contract for this function.
Examples
Notes
- Formula examples are preserved from maintained workbook usage and normalized to the current
U.prefix. - Complete formulas demonstrate working patterns; they do not imply that undocumented option values are supported.
- Where maintained sources do not specify every accepted value, default, or error message, this page does not infer one.
- For functions that perform actions, use a visible trigger or supported block/throttle parameter to avoid unintended repetition during recalculation.
Related
- How-to: Process CSV Files
- Example: CSV Processing Pipeline
- Concept: Caching and Throttling