No such thing as a small change | |
PerlMonks |
Can't Find my way in Excelby ExReg (Priest) |
on Sep 17, 2019 at 17:02 UTC ( [id://11106304]=perlquestion: print w/replies, xml ) | Need Help?? |
ExReg has asked for the wisdom of the Perl Monks concerning the following question: I am looking for ways to speed up the searching for words in Excel. Currently, I simply loop through the used cells range and examine each cell's contents. For some spreadsheets this can take almost a minute if they have hunreds of columns and thousands of rows and dozens of sheets. When I have thousands of documents, this is too long. I had a similar problem in Word where I had to search thousands of paragraphs in thousands of documents. What I did when I had only words to search for (not regexen) is use Word's Find function. This sped things up by an order of magnitude. I was wondering if anyone knew the syntax for Excel Finds. It is not the same as Word's. I have tried to translate the VBA that does work into Perl, but have failed thus far. I currently search with something like this:
The code that uses Excel's Find in VBA is Set Loc = ThisWorkBook.Sheets(n).UsedRange.Cells.Find(What:="cabbage")Any Ideas? I have tried things like my $loc = $Sheet->UsedRange->Cells->Find({What}=>"cabbage") and variations to no avail. As always, I hope I have typed this in correctly. Please excuse any typos. And I cannot use any CPAN.
Back to
Seekers of Perl Wisdom
|
|