0

How do you extract the data using regex in a workbook. For example, I want to extract a set of strings that match a pattern in the workbook which contains many sheets.

Chas. Owens
  • 64,182
  • 22
  • 135
  • 226
User1611
  • 1,081
  • 4
  • 18
  • 27

2 Answers2

4

Install the Spreadsheet::ParseExcel module and,
Look at question converting an Excel (xls) file to a comma separated (csv) file without the GUI.
From there you can use grep on the generated CSV data.

Community
  • 1
  • 1
nik
  • 13,254
  • 3
  • 41
  • 57
  • You don't have to do the conversion to CSV; assuming Perl is what you intend to process in, then the first part of this is all you need to know. That said, the question referenced will have decent example code in. – ijw Jul 07 '09 at 19:39
  • I guess, I should not have written the last line about using the CSV output for this answer. While that can be done it would be a round-about way. And, I `was` referring to the perl script as an example. – nik Jul 08 '09 at 05:05
1

There is a Perl utilty called XLS Tools that allows you to grep an Excel file using Perl command-line idioms. For example:

XLSperl -nle '/pattern/ and print' file.xls
jmcnamara
  • 38,196
  • 6
  • 90
  • 108