code: def sheet_to_df(sheet) -> list:
      """
      Returns a list of dataframes for each data table in a given spreadsheet
  
      Args:
          sheet (list): A 2D array of the contents of the Google Sheet
  
      Returns:
          list: A list of dataframes from the Google Sheet.
      """
  
      # A dataframe starts when a header is found
      # A header is a the first instance of a set of contiguous alphanumeric columns
      # A dataframe ends when a blank row is found or an empty column is found
  
      num = 0  # The number of the dataframe
      headers = (
          []
      )  # Each header is a tuple (num, row, col_start, col_end)
      binding_headers = []
      dfs = []  # Each df is a tuple (num, df)
  
      # First pass: get all the headers
      for row in range(len(sheet)):
          # if every cell in the row is empty, skip row
          if all(
              sheet[row][col].strip() == ""
              for col in range(len(sheet[row]))
          ):
              headers += binding_headers
              binding_headers = []
              continue
  
          for col in range(len(sheet[row])):
              # Check if the cell is bounded by a header
              if any(
                  col >= header[2] and col <= header[3]
                  for header in binding_headers
              ):
                  continue
  
              # Check if the cell is commented out
              if sheet[row][col].strip().startswith("//"):
                  continue
  
              if re.search("[a-zA-Z]", sheet[row][col]):
                  head_start = col
                  head_end = col
                  while head_end < len(sheet[row]) and re.search(
                      "[a-zA-Z]", sheet[row][head_end]
                  ):
                      head_end += 1
                  binding_headers.append(
                      [num, row, head_start, head_end]
                  )
                  num += 1
      headers += binding_headers
  
      # Second pass: get all the dataframes
      for header in headers:
          df = []
          for row in range(header[1], len(sheet)):
              if all(
                  sheet[row][col].strip() == ""
                  for col in range(header[2], header[3])
              ):
                  break
              df_row = [
                  sheet[row][col] for col in range(header[2], header[3])
              ]
              df.append(df_row)
          cols = df[0]
          data = df[1:]
          df = pd.DataFrame(data, columns=cols)
  
          # Cast all the numeric columns to numeric types
          for col in df.columns:
              try:
                  df[col] = pd.to_numeric(df[col])
              except ValueError:
                  pass
          dfs.append(df)
  
      return dfs
  
imports: import requests
  import pandas
  import re
label_desc: Use image node_id 2 for calling a global function with example usage: sheet_to_df(sheet) and returns: dfs