Reading Excel data

When using Excel data for data processing, note the following when reading Excel data.

(1) Specifying a management Excel file

A file that is used to display an Excel image for Excel information is called a management Excel file.

When selecting fields on Excel either by selecting one cell or by specifying a data range, display the management Excel file in the Excel import settings screen, and then use the mouse to specify settings.

The Excel management file is stored in the following locations:

  • For the DataMagic Server grade: An OS on which DataMagic Server is running

  • For the DataMagic Desktop grade: An OS on which DataMagic Desktop is running

(2) Excel file formats

In DataMagic, Excel 97-2003 or earlier (.xls) and Excel 2007 or later (.xlsx or .xlsm) can be used for the input file, matching file, and virtual table data. The Excel file format is automatically determined according to the extension. The output file is always output as Excel 2007 or later (.xlsx or .xlsm). For a type of data processing in which Excel 97-2003 (.xls) is used as the output format, use database connection information and database table information to coordinate the format.

(3) Sheets to be read

When reading data from a book file, you can specify the target sheets by using the following methods:

  • All sheets

  • Specify sheets to read

  • Specify sheets to exclude

By specifying a method for selecting target sheets and specifying the names of individual target sheets, you can specify for data to be read in units of single sheets or in units of multiple sheets according to your needs.

Figure 4.92 Read image of sheets

a) Reading data in units of individual sheets

To read data of a book file in units of individual sheets, use the following settings:

  • If one book file contains only one sheet:

    Use either of the following settings:

    • Select All sheets.

    • Select Specify sheets to read, and then specify the name of a sheet to be read.

  • If one book file contains multiple sheets:

    Use either of the following settings:

    • Select Specify sheets to read, and then specify the name of one sheet you want to read.

    • Select Specify sheets to exclude, and then specify the names of multiple sheets that you want to exclude from being read.

      This method is useful when the name of a sheet you want read contains values, such as dates, that vary depending on the operating system environment.

= Remarks =

To specify multiple sheet names, use a slash (/) to separate sheet names.

Example:

 

b) Reading data in units of multiple sheets

Note

The sheets to be read must be in the same format.

To read data of a book file in units of multiple sheets, use the following settings:

  • Select All sheets.

    All the sheets will be read.

  • Select Specify sheets to read, and then specify the names of multiple sheets you want to read.

    This method is useful when you want to read only some of the sheets in a book file. Use a slash (/) to separate the names of sheets to be read.

  • Select Specify sheets to exclude, and then specify a name of one sheet or the names of multiple sheets that you want to exclude from being read.

    This method is useful when you want to exclude from being read sheets that contain fixed content, such as a front cover or memos.

(4) Reading data contained in a sheet

Use the methods described below to read data contained in a sheet. You can use the method for reading data in units of records and the method for reading data in units of cells together.

Read data in units of records

Use this method to read data in a specific range of cells in a single row. The data is regarded as a single record and read vertically. This method is useful for reading Excel data in a table format where data is contained in consecutive rows.

Read data in units of cells

Use this method to read data by directly specifying locations of cells. This method is useful for reading Excel data in a ledger format where locations of data to be read is scattered throughout a sheet.

Figure 4.93 Image of the reading of the Excel data

a) Reading data in units of records

To read data in units of records, specify a field name of your choice for the field name.

Specify a column letter for the column.

Example: "A"

 

You can combine the following two methods to specify a data range to be read.

  • Specify a row from which reading starts

    Data reading starts from the row number specified in the Initial row number field. Data in a table format where the header cell contains information can also be read.

  • Specify a row where reading ends

    Specify the position at which the reading ends in the End position field.

    • When the End position field is set as End of data (reading ends at the last row of data)

      The data range to be read ends in a row that is regarded as the last row of the existing data, such as the row where the table line settings end, or the row where data ends.

    • When the End position field is set as Empty record (reading ends at an empty record)

      If a row that consists only of empty cells is found, the row is handled as the end of the range to be read.

    • When the End position field is set as Empty row in a specified column (reading ends at the row with an empty cell at the specified column)

      If a row that consists of an empty cell at the target column is found, the row is handled as the end of the range to be read.

    • When the End position field is set as Specified row (reading ends at the specified row)

      The row specified in the Final row number field is handled as the end of the range to be read.

    • When the End position field is set as Row containing an empty cell (reading ends at a record with an empty cell)

      The data range to be read ends in a row where an empty cell appears in a column of your choice that is specified for a table range.

Figure 4.94 Overview - Data reading in units of records

b) Reading data in units of cells

To read data in units of cells, specify a field name of your choice for the field name.

Specify a column letter and a row number for the cell.

Example: "A1"

 

You can use the following methods to read cells:

  • Read a single cell

    Data is read from only a single cell of a sheet. This is a basic method for specifying cells when reading data in units of cells.

  • Read multiple cells

    Repeat the procedure for reading a single cell to read data of multiple cells. A method for reading multiple consecutive cells by using a colon (:), which is used to indicate a range of cells, is not supported.

  • Read cells with numeric formulas

    If numeric formulas are set to cells, calculation results are read as data.

  • Read cells where a calculation error occurred

    If an error value is displayed as a calculation result of a numeric formula, the cell is read as an empty cell. Alternatively, read processing can be abnormally ended as an error.

  • Read merged cells

    If cells are merged, data of that merged cells will be read as a value of the top left cell in the merged range. For other cells in the merged range, the default value of the applicable data type is read as data. For example, when reading data of a numerical value, a value "0" will be read.

Figure 4.95 Overview - Data reading in units of cells