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

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.

Related

VSCode: is it possible to create a command that will fill a file with text on creation?

At my place of work, we have a standard source header. I've been using snippets to generate it when adding text to a file. However, since it's supposed to be pretty much used on everything, I figure I might as well see if I can automate its generation on file creation.
Is there a way to automatically add text to a file on creation in vscode? Can I generate different text based on the file extension?

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?

Custom ListView will replace already existing Listview

I have built an addon and that has custom listview for Contacts module.
The filepath is /custom/modules/Contacts/views/view.list.php.This file has listViewProcess() function with my custom code.
Installing the addon will copy this file.
But if someone already had this file it will be replaced.
How can I overcome this?
Overall, you can't automatically overwrite and respect the existing file at the same time. Your best bet is probably to use a pre_execute script to display a warning/explanation of what is happening to that file. If you're planning to support Sugar's OnDemand service, that's about all you can do. If you're CE-only or not worried about OnDemand, though, you could use a file_exists check and adjust your warning or abort mission, maybe even back-up the existing file.

How to write to an existing .xlsm file through 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.

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.