Input data recieved from an email into a CSV/Excel/LibreOffic Calc file - excel

Having a bit of trouble with a script I am trying to create. Basically I would like it to send out a reminder email to send hours I worked that day, then I send a reply, the script will read the email for date start time and end time and then input this data into a CSV/Excel/LibreOffic calc file. A new line for each date. I have manage to sort out the email sending and reading part, then inputting the data into a variable for the next subroutine to read (the excel bit). But I am not sure on how to go about this part. I have seen many suggestions of using Text::CSV and other modules but i'm not certain on how to use them? also how would I go about making it append to the end of the document instead of just overwriting it?
Thanks in advance guys

CSV is very easy to read and parse, and Text::CSV is very easy to use too. What specific problems are you having with Text::CSV, and what have you tried?
If you want true Excel format, it looks like you'd need to read the existing contents with something like Spreadsheet::XLSX, write it back out using something like Excel::Writer::XLSX, and append your data to it as you're back out the original data.
CSV is simpler, though, if you can live with it. You could open the file in append mode, and just write to it. To do so, build up your data into columns, and "combine" them ($csv->combine (#columns)), then create a string out of that ($csv->string()) that you can write to your original file.

Related

Insert Hyperlink in Access Database (pyodbc)

Here is the situation: I'm 'having fun' really using Microsoft Access for the first time for small personnal project/tools ideas.
I don't know anything about VBA yet, and unless I can't do without it, I don't plan to learn it this time (already a lot else to cover).
So I tried to use Python to automatize the main table filling. I did find pyodbc package and succeeded to connect, read and write some data out of my database.
However, I wanted to experiment a little further, and one of the fields could contain hyperlinks (could be handled somewhere else in another script later, but I am curious about the functionality anyway)...
But I couldn't figure how to insert hyperlink data in the table. I only get the displayed text set, but not the target one.
Is this feasible using pyodbc or am I on the wrong track?
Thanks in advance!
Emmanuel
The hyperlink field in MS Access consists of three parts, separated by #:
display text # filename or target # location within the document
So an example of the data of a field can look like this:
StackOverflow#http://www.stackoverflow.com#
See the docs: https://learn.microsoft.com/en-us/office/vba/api/access.application.hyperlinkpart
and samples here also: http://allenbrowne.com/casu-09.html

Need to read the excel attached in BMC Remedy incident via REST API

I need to read the excel attached within an incident in BMC Remedy. I am already connecting to Remedy via REST and can read the attachment but the thing is that it gets converted to String so only text based files like .txt, .log or .csv could be read but if at all the excel is attached obviously since it is not text based all I receive is gibberish.
So I am looking for a REST call that can read the excel and if cannot(which is quite possible) I am looking for a REST call with which I can download the excel locally.
Or if anyone has any other suggestion that would be really helpful

How to log in and auto fill values into a 'drupal form' from an 'excel file'?

So, there is this website where I have to log in and insert values in the add content->person roles and I have to take values from an excel file. I tried entering the values in the database directly but got nowhere. The database is too randomly generated.
I want to know- how to go by this problem? I think python would be the best way but I am more comfortable with java. The images bellow will help understand the situation better-
The log in from:
The form to be filled:
Try using feeds module:
https://www.drupal.org/project/feeds
Install it on you site first of course. Or look for some similar import module. Maybe this one:
https://www.drupal.org/project/datasources
If nothing succeeds then try making import script on your own. You have to parse document (would be much easier to open it from excel and export as CSV if possible http://php.net/manual/en/function.fgetcsv.php) and have some loop to write content into Drupal system. Use Drupal's functions for that, do not directly write to database. It's not hard as it looks like:
https://www.drupal.org/node/1388922

Application.LoadfromText...load from string instead?

I was wondering if it is possible to use the code saved in the .txt file using the application.savetotext and save the code in a table, then use the application.loadfromtext to to build the object from a string rather that a .txt file
Does that make any sense? Basically I'm wanting to store all the object codes in a table on separate rows and allow users to select the relevant row and build the object without having to import the .txt file
Yes and no. You would have to write the field content to a (temp) file, then use LoadFromText to read in the object.
But it doesn't make much sense, and I think you are on a wrong track. You could just as well have the objects ready-made in application.

Search directory for single file and add file to zip

I'm wondering if this is possible and the best way to accomplish it if it is.
Scenario: We have multiple sites that create a "dated subdirectory" each day at a certain time. The dated subs contain information for that day of business.
I need to pull a single DBF file out of the dated sub each day and either export the data to an ever-expanding Excel file, that contains information from the single DBF file from EACH day so it looks like:
Day 1's information
.
.
.
Day 2's information
.
.
.
Day 3's information
OR
Add a copy of the DBF file from each dated sub to a ZIP file that is done daily.
The name of the DBF file never changes, and can't be deleted.
I'm thinking it could be done with a forfiles command, but am curious if it could be done more efficiently. The file that searches, pulls, and zips would be run as a task nightly.
As an add-on, could it be pushed to a Google Drive for safe storage?
Sorry if this is rambling. This is something I'd love to try to do, but not sure where to start exactly.
-Dated sub created nightly, single file from that directory needs to be pulled or read and transferred either to an Excel file or copied to a ZIP with a way to seperate each file, maybe a directory with date as name?
Also, if able, it needs to start with a particular date, like 6/1/2014 but no further back.
Thanks in advance for any help.
Can you merge data from a DBF file to an Excel file? Not really with pure batch, but you can use JScript or VB Script. You'll need the MS ACE OLEDB 12.0 driver. Then you can use a connection string for DBF and another for XLSX. (If you're using XLS or CSV, you could get by with the MS Jet driver, running the WOW64 version of cscript.) Once connected, just use SQL queries. SELECT * FROM dbffile, and as you're looping through the recordset, INSERT INTO xlsxfile.
Can you append a DBF file to a zip file? Probably. I'm guessing 7za.exe a will append to the archive if the archive already exists. Try it and see. Or were you wanting to script the zip functionality without 3rd party software?
Can it be copied to a Google Drive? Well, yeah, the Google Drive software watches and mirrors a folder on your hard drive. So chances are, copying the file to %userprofile%\Google Drive\ will do what you want without any conscious effort.
Try posting another question. But rather than rambling again, find one specific problem where you're getting stuck, and explain what you've tried without success.

Resources