class Multiwoven::Integrations::Destination::MicrosoftExcel::Client

def group_by_table(records)

def group_by_table(records)
  result = {}
  records.each_with_index do |entries, entries_index|
    entries[:worksheets].each_with_index do |sheet, entry_index|
      workbook_sheet = "#{entries[:name]}, #{sheet[:sheet_name]}"
      columns = sheet[:column_names].map do |column_name|
        column_name = "empty column" if column_name.empty?
        {
          column_name: column_name,
          data_type: "String",
          is_nullable: true
        }
      end
      result[entries_index] ||= {}
      result[entries_index][entry_index] = { workbook: workbook_sheet, columns: columns }
    end
  end
  result
end