src/pds_doi_service/core/input/input_util.py
def parse_xls_file(self, xls_path):
        """
        Parses DOIs from an Excel file with an .xls or .xlsx extension.
        Each row within the spreadsheet is parsed into a distinct DOI object.

        Parameters
        ----------
        xls_path : str
            Path to the Excel file to parse.

        Returns
        -------
        dois : List of Doi
            DOI objects parsed from the provided Excel file.

        Raises
        ------
        InputFormatException
            If the provided Excel file contains less than the expected number
            of columns.

        """
        logger.info("Parsing xls file %s", basename(xls_path))

        xl_wb = pd.ExcelFile(xls_path, engine="openpyxl")

        # We only want the first sheet.
        actual_sheet_name = xl_wb.sheet_names[0]

        xl_sheet = pd.read_excel(
            xls_path,
            actual_sheet_name,
            # Remove automatic replacement of empty columns with NaN
            na_filter=False,
        )

        # Any empty rows will result in NaT being filled in for the publication_date.
        # Key off of this to drop those rows. Since we provided na_filter=False,
        # there should not be any N/A or NaT values anywhere else.
        xl_sheet = xl_sheet.dropna(how="any")

        xl_sheet = self._validate_spreadsheet(xl_sheet)

        dois = self._parse_rows_to_dois(xl_sheet)

        return dois

        Parses DOIs from an Excel file with an .xls or .xlsx extension.
        Each row within the spreadsheet is parsed into a distinct DOI object.

        Parameters
        ----------
        xls_path : str
            Path to the Excel file to parse.

        Returns
        -------
        dois : List of Doi
            DOI objects parsed from the provided Excel file.

        Raises
        ------
        InputFormatException
            If the provided Excel file contains less than the expected number
            of columns.

        
Parses DOIs from an Excel file with an .xls or .xlsx extension.
Each row within the spreadsheet is parsed into a distinct DOI object.

Parameters

xls_path : str
Path to the Excel file to parse.

Returns

dois : List of Doi
DOI objects parsed from the provided Excel file.

Raises

InputFormatException
If the provided Excel file contains less than the expected number
of columns.
Parses DOIs from an Excel file with an . xls or . xlsx extension . Each row within the spreadsheet is parsed into a distinct DOI object . Parameters xls_path : str Path to the Excel file to parse . Returns dois : List of Doi DOI objects parsed from the provided Excel file . Raises InputFormatException If the provided Excel file contains less than the expected number of columns .
def parse_xls_file(self, xls_path):
        logger.info("Parsing xls file %s", basename(xls_path))
        xl_wb = pd.ExcelFile(xls_path, engine="openpyxl")
        actual_sheet_name = xl_wb.sheet_names[0]
        xl_sheet = pd.read_excel(
            xls_path,
            actual_sheet_name,
            na_filter=False,
        )
        xl_sheet = xl_sheet.dropna(how="any")
        xl_sheet = self._validate_spreadsheet(xl_sheet)
        dois = self._parse_rows_to_dois(xl_sheet)
        return dois
def parse_xls_file ( self , xls_path ) : logger . info ( "Parsing xls file %s" , basename ( xls_path ) ) xl_wb = pd . ExcelFile ( xls_path , engine = "openpyxl" ) actual_sheet_name = xl_wb . sheet_names [ 0 ] xl_sheet = pd . read_excel ( xls_path , actual_sheet_name , na_filter = False , ) xl_sheet = xl_sheet . dropna ( how = "any" ) xl_sheet = self . _validate_spreadsheet ( xl_sheet ) dois = self . _parse_rows_to_dois ( xl_sheet ) return dois
Parses DOIs from an Excel file with an .xls or .xlsx extension.
Parses DOIs from an Excel file with an . xls or . xlsx extension .
"""
        Parses DOIs from an Excel file with an .xls or .xlsx extension.
        Each row within the spreadsheet is parsed into a distinct DOI object.

        Parameters
        ----------
        xls_path : str
            Path to the Excel file to parse.

        Returns
        -------
        dois : List of Doi
            DOI objects parsed from the provided Excel file.

        Raises
        ------
        InputFormatException
            If the provided Excel file contains less than the expected number
            of columns.

        """ # We only want the first sheet. # Remove automatic replacement of empty columns with NaN # Any empty rows will result in NaT being filled in for the publication_date. # Key off of this to drop those rows. Since we provided na_filter=False, # there should not be any N/A or NaT values anywhere else.
self
xls_path