Skip to content

Unable to parse Metadata Part #372

Open

Description

@wagneramaral

When I try to parse a xlsm file containing an instance of metadata part I receive the following message:

*** WARNING: storage class not found for metadata.xml (http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata)
WARNING: RubyXL::Workbook is not aware how to process RubyXL::GenericStorageObject

Reference to metadata part (page 81).

The simplest example that produce the error is the following:

def foo
    workbook = RubyXL::Parser.parse_buffer(Allocation.first.file.download)
    respond_with workbook.stream.read
end

It's not possible to open the exported file in Excel.
I also tried the parse method using the file path, it results in the same warning message and the exported file is also not readable in Excel.

Am I doing something wrong, or is there any workaround I can apply to parse xlsm files with metadata part?
Unfortunately I can't provide the file as it contains sensitive data from a third party.

Anyway, thank you for this amazing gem.

Activity

  1. seki commented on Mar 18, 2021

    @seki

    Monkey patched.

    module RubyXL
      class SheetMetadata < GenericStorageObject
        CONTENT_TYPE = 'application/vnd.ms-excel.sheetMetadata'
        REL_TYPE     = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata'
      end
    
      class Workbook
        define_relationship(RubyXL::SheetMetadata)
      end
    end
    
  2. weshatheleopard commented on Mar 18, 2021

    @weshatheleopard
    Owner

    @seki Can you please attach a sample file with which you are experiencing this issue?

  3. seki commented on Mar 19, 2021

    @seki

    Sorry, I can't show the sample file.

    require 'rubyXL'
    
    module RubyXL
      class SheetMetadata < GenericStorageObject
        CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml'
        REL_TYPE     = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata'
      end
    
      class Workbook
        define_relationship(RubyXL::SheetMetadata)
      end
    end
    
    def foo(src, dest)
      workbook = RubyXL::Parser.parse(src)
      workbook.write(dest)
    end
    
    foo(ARGV.shift, ARGV.shift)
    
  4. mewthu2 commented on Apr 18, 2022

    @mewthu2

    Sorry, I can't show the sample file.

    require 'rubyXL'
    
    module RubyXL
      class SheetMetadata < GenericStorageObject
        CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml'
        REL_TYPE     = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata'
      end
    
      class Workbook
        define_relationship(RubyXL::SheetMetadata)
      end
    end
    
    def foo(src, dest)
      workbook = RubyXL::Parser.parse(src)
      workbook.write(dest)
    end
    
    foo(ARGV.shift, ARGV.shift)
    

    Try to parse another xlsx file, i have the same problem today and this resolve the issue

  5. HLFH commented on Oct 17, 2023

    @HLFH

    Here is my monkeypatch for - I suppose - a Google Sheets document that has been exported as an Excel file:

    # Monkeypatch
    module RubyXL
      class SheetMetadata < GenericStorageObject
        CONTENT_TYPE = 'application/vnd.ms-excel.sheetMetadata'
        REL_TYPE     = 'http://customschemas.google.com/relationships/workbookmetadata'
      end
    
      class Workbook
        define_relationship(RubyXL::SheetMetadata)
      end
    end
  6. weshatheleopard commented on Oct 17, 2023

    @weshatheleopard
    Owner

    Can somebody give me a sample file that exhibits this behavior already?

  7. khiav223577 commented on Oct 29, 2023

    @khiav223577

    Can somebody give me a sample file that exhibits this behavior already?

    Try this file: test.xlsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions