How to write to an existing .xlsm file through Perl - perl

Could someone please clarify if there is any Perl package to edit a pre-existing .xlsm file?
I tried few examples posted in CPAN page and this site which use the combination of WriteExcel and ParseExcel::SaveParser. They are not working for .xlsm file.
Any help would be appreciated.
Thanks.

It's not possible to open an existing xlsm file using Excel::Writer::XLSX, as of version 0.72 Excel::Writer::XLSX, according to the page given by psxls (quote: "This module cannot, as yet, be used to write to an existing Excel XLSX file.").
A solution is to use Win32:OLE, it's well explained in this tutorial: http://www.perlmonks.org/?node_id=153486. It tested it on my side, I was able to modify a pre-existing xlsm file.

I think Excel::Writer::XLSX should work for you. For getting started, you can check the related author's blog post and a related Perl script example.

Related

How to open custom wikidata RDF dumps

I have created a custom wikidata dump from https://wdumps.toolforge.org/ . Can anyone please tell me how to open and read that dump file ? File comes in .nt format
You can find recent dump files here: https://wdumps.toolforge.org/dumps
Depends how you want to read it. With visual studio code you can just open the file and see inside it. Other text editors should also work I think. Or do you want to have a more specific app for it?
Also its handy to mention if you'r on windows or not.
update:
You first need to unzip it, you can do this with winzip on a command line or a library in any language that does this.
https://support.winzip.com/hc/en-us/articles/115011594767-How-to-extract-gzip-and-tar-files-on-the-command-line
then you will get a file with lines like this:
<http://wikiba.se/ontology#Property> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> .
from there you can parse it with regex to get the pages out of it, dunno what you want? property, type or class?

Perl how to add sheet into existing excel file which contains macros and formulas?

I have a problem with editing a file.
I'm using the module Spreadsheet::ParseExcel::SaveParser from CPAN.
The existing data in the file I want to add a new set of data and save the file as a new.
Unfortunately, the new file will not write a macro or formula.
Does anybody know how to solve this problem?
This is a limitation of Spreadsheet::ParseExcel, I believe.
You should be able to do it with Win32::OLE, which allows you to programmatically control Excel itself. See the first example in the documentation.

How to read excel file using xmldocument

I need to read the Excel data using Xmldocument.Plz help me
You shouldn't.
Better use Office Open XML libraries from Microsoft.
I can't give some code but, you have to extract xlsx contents with System.IO.Packaging, find the sheet you need, and then load it in XmlDocument.
But be advised that it is quite tricky and has many caveats to do so.

How to get SelBlocks Selenium IDE extension to find XML file?

Hopefully, Chris Noe, is in the house...
Selblocks is an extension for Selenium IDE that provides control-flow constructs such as if/then/else, looping and subroutines.
I'm trying to give interation over an XML file a whirl and am running into an error. It seems it can't find the XML file. The XML file is co-located with my Sel scripts. Please see the screenshot attached.
Is there a source for more documentation or examples? Like the sample test suite you have a picture of on the extension page?
Thanks,
Cameron
http://cl.ly/AzzT
I ran into the same issue, and the problem turned out to be that my XML was invalid. In my case it was because one of the parameters I was using was a url containing ampersands. Changing & to & fixed the problem for me, and the variables loaded perfectly.

How can I get all HTML pages from a website subfolder with Perl?

Can you point me on an idea of how to get all the HTML files in a subfolder and all the folders in it of a website?
For example:
www.K.com/goo
I want all the HTML files that are in: www.K.com/goo/1.html, ......n.html
Also, if there are subfolders so I want to get also them: www.K.com/goo/foo/1.html...n.html
Assuming you don't have access to the server's filesystem, then unless each directory has an index of the files it contains, you can't be guaranteed to achieve this.
The normal way would be to use a web crawler, and hope that all the files you want are linked to from pages you find.
Look at lwp-mirror and follow its lead.
I would suggest using the wget program to download the website rather than perl, it's not that well suited to the problem.
There are also a number of useful modules on CPAN which will be named things like "Spider" or "Crawler". But ishnid is right. They will only find files which are linked from somewhere on the site. They won't find every file that's on the file system.
You can also use curl to get all the files from a website folder.
Look at this man page and go to the section -o/--output which gives u a good idead about that.
I have used this a couple of times.
Read perldoc File::Find, then use File::Find.