Skip to main content

Data.read

Data.readpathformaton_problems

Group: Input
Aliases: load, open

Documentation

Reads a file into Enso. Uses the specified file format to parse the file into an Enso type. If not specified will use the file's extension to determine the file format.

Arguments

  • path: The path to the file to read. If the path is a URI, then the data will be fetched if from a supported protocol.
  • format: A File_Format object used to read file into memory. If Auto_Detect is specified; the provided file determines the specific type and configures it appropriately. If there is no matching type then a File_Error.Unsupported_Type error is returned. You can use File_Format.all to get a list of currently loaded formats.
  • on_problems: Specifies the behavior when a problem occurs during the function. By default, a warning is issued, but the operation proceeds. If set to Report_Error, the operation fails with a dataflow error. If set to Ignore, the operation proceeds without errors or warnings.

Examples

Read the first sheet of an XLSX from disk and convert it into a table.

      from Standard.Table import all
import Standard.Examples

example_xlsx_to_table = Data.read Examples.xlsx

Read the sheet named Dates from an XLS and convert it to a table.

      from Standard.Table import all
import Standard.Examples

example_xls_to_table = Data.read Examples.xls (..Sheet 'Dates')

Remarks

Request Caching

Responses to HTTP data requests are cached, and additional requests for the same resources will use the cache, saving a round-trip call to the remote server. Two resources are considered the same if the URIs and request headers are the same. Header order does not affect sameness.

The cache respects the "max-age" and "Age" response headers; see Data.fetch for more details.

The cached values are retained as long as the project remains open. Closing a project will clear the cache.