0

To list all the files in a spreadsheet (xlsx) file, I can do:

$ unzip -l /Users/david/Desktop/myspreadsheet.xlsx
      698  01-01-1980 00:00   xl/_rels/workbook.xml.rels
1415625191  01-01-1980 00:00   xl/worksheets/sheet1.xml
     6798  01-01-1980 00:00   xl/theme/theme1.xml
     2315  01-01-1980 00:00   xl/styles.xml
   779218  01-01-1980 00:00   xl/sharedStrings.xml
      322  01-01-1980 00:00   xl/worksheets/_rels/sheet1.xml.rels
     9840  01-01-1980 00:00   xl/printerSettings/printerSettings1.bin
      640  01-01-1980 00:00   docProps/core.xml
      797  01-01-1980 00:00   docProps/app.xml

From here we can see that the spreadsheet has one sheet -- xl/worksheets/sheet1.xml. Is there a way to only see the zip contents of the xl/worksheets/ folder? For example, doing something like:

$ unzip -l /Users/david/Desktop/myspreadsheet.xlsx xl/worksheets

The most I could find from man was:

   -l     list archive files (short format).  The names, uncompressed file sizes and modification dates  and
          times of the specified files are printed, along with totals for all files specified.  If UnZip was
          compiled with OS2_EAS defined, the -l option also lists columns  for  the  sizes  of  stored  OS/2
          extended  attributes (EAs) and OS/2 access control lists (ACLs).  In addition, the zipfile comment
          and individual file comments (if any) are displayed.  If a file was archived  from  a  single-case
          file  system  (for example, the old MS-DOS FAT file system) and the -L option was given, the file-
          name is converted to lowercase and is prefixed with a caret (^).

But it seems like there are tons of other options. Is there a way to do the above?

David542
  • 104,438
  • 178
  • 489
  • 842

0 Answers0