コード例 #1
0
    def read_worksheet_as_table(self,
                                name=None,
                                header=False,
                                trim=True,
                                start=None):
        """Read the content of a worksheet into a Table container. Allows
        sorting/filtering/manipulating using the ``RPA.Tables`` library.

        :param name:   Name of worksheet to read
        :param header: If `True`, use the first row of the worksheet
                       as headers for the rest of the rows.
        :param trim:   Remove all empty rows from the end of the worksheet
        :param start:  Row index to start reading data from (1-indexed)

        Examples:

        .. code-block:: robotframework

            Open Workbook   orders.xlsx
            ${table}=       Read Worksheet As Table     header=True
            Close Workbook
        """
        tables = Tables()
        sheet = self.read_worksheet(name, header, start)
        return tables.create_table(sheet, trim)
コード例 #2
0
    def read_worksheet_as_table(self, name=None, header=False, trim=True, start=None):
        """Read the content of a worksheet into a Table container. Allows
        sorting/filtering/manipulating using the `RPA.Tables` library.

        :param name:   Name of worksheet to read
        :param header: If `True`, use the first row of the worksheet
                       as headers for the rest of the rows.
        :param trim:   Remove all empty rows from the end of the worksheet
        :param start:  Row index to start reading data from (1-indexed)
        """
        tables = Tables()
        sheet = self.read_worksheet(name, header, start)
        return tables.create_table(sheet, trim)
コード例 #3
0
 def get_orders(self, excel):
     files = Files()
     workbook = files.open_workbook(excel)
     rows = workbook.read_worksheet(header=True)
     tables = Tables()
     table = tables.create_table(rows)
     tables.filter_empty_rows(table)
     orders = []
     for row in table:
         order = {
             "item": row.Item,
             "zip": int(row.Zip),
             "first_name": row[0].split()[0],
             "last_name": row[0].split()[1]
         }
         orders.append(order)
     return orders
コード例 #4
0
ファイル: AWS.py プロジェクト: krehl/rpaframework
    def _process_tables(self, raw_tables):
        self.tables = {}
        for idx, t in raw_tables.items():
            rows = {}
            for tid in t:
                row = self.cells[tid]["RowIndex"]
                col = self.cells[tid]["ColumnIndex"]
                val = self.cells[tid]["Content"]
                if row in rows.keys():
                    rows[row][col] = val
                else:
                    rows[row] = {col: val}

            tables = Tables()
            data = [[rows[col][idx] for idx in sorted(rows[col])]
                    for col in sorted(rows)]
            table = tables.create_table(data)
            self.tables[idx] = table
コード例 #5
0
ファイル: Files.py プロジェクト: qunub/rpa-framework
    def read_worksheet_as_table(self, name=None, header=False, trim=True):
        """Read the content of a worksheet into a Table container. Allows
        sorting/filtering/manipulating using the `RPA.Tables` library.

        :param name:   Name of worksheet to read
        :param header: If `True`, use the first row of the worksheet
                       as headers for the rest of the rows.
        :param trim:   Remove all empty rows from the end of the worksheet
        """
        tables = Tables()
        sheet = self.read_worksheet(name, header)

        table = tables.create_table(sheet)
        if trim:
            tables.trim_empty_rows(table)
            tables.trim_column_names(table)

        return table