Using this website on file signatures I have found the beginning of the file header for an XLS spreadsheet:
"09 08 10 00 00 06 05 00"
I was wondering if there was any further information you can glean from the header such as Author etc.?
Not from headers per se: an XLS file is an OLE document. To extract the autor etc, you need to be able to read the SummaryInformation and DocumentSummaryInformation streams from within that file.
Related
Software:
Powershell 3.0, Windows 7, SharePoint 2010
Task:
Move 1000+ different pdf files from a SharePoint folder and place them into different folders based on the first 10 characters of the filename. This is all done on the same SharePoint site.
I will basically be taking data from one folder and putting them into about 10 different folders (same as the first two characters for each filename, e.g. 01-000.001)which have multiple subfolders, e.g. 01-000.001 (each with the same name as the first 10 characters of the filenames).
Comments:
I am quite new at Powershell and stackoverflow (so it won't let me put more than one resource link). In SharePoint there are already named folders where the data needs to be distributed..or at least there should be one already. It would be great if I could have it put out a report at the end to tell me if everything copied over ok. I would really appreciate any input!
Example:
Take files named 02-001.000-Hello.pdf, 02-002.253 HelloWorld.pdf, 02-001.001HelloWorld.pdf from TEST folder and place them into subfolders inside of folder 02 with subfolders being named 02-001.000, 02-002.253, 02-001.001.
For files starting with 03 I would put them into the subfolders under the 03 folder. etc...
Directory Structure Sample:
where they are coming from:
SharePointSite URL/TEST FOLDER/sourcefiles
where they are going to:
SharePointSite URL/PRODUCTION FOLDERS/01/subfolders with names same as first 10 characters of filename (first 2 characters are 01 in this case)
SharePointSite URL/PRODUCTION FOLDER/02/subfolders with names same as first 10 characters of filename (first 2 characters are 02 in this case)
and so on...
Resources:
Copy Files To Folders Based On Filename
I have manually pasted a large number of linked pictures into a 2010 Excel spreadsheet using insert picture -> select picture location --> link to file. These pictures are part of a report. I update the pictures using R each quarter, and my report automatically updates. Perfect.
I now need to change the directory where the plots are kept, and need to update the links. As there are around 200 of them (its a big report), I want to do this in VBA. Whilst I can loop through the pictures ok (ActiveSheet.Pictures), I can't seem to find the links/address. Any idea how I can see the underlying file location so I might change it - the reference has to be stored somewhere (note - these don't seem to be stored as hyperlinks).
Any idea how I can see the underlying file location so I might change it - the reference has to be stored somewhere
Create a new folder
Paste a copy of the .xlsx or .xlsm excel file
Uncompress the file with a zip tool (i'm using 7-Zip)
Delete the .xlsx or .xlsm file (optional)
Now we have all the component parts of the original file as plain text xml files and folders
Inside the folder xl\drawings\ _rels there are files named as drawing2.xml.rels, drawing3.xml.rels, ...
It seems that each file corresponds to a sheet and stores the paths to images in this format:
Target="file:///C:\Users\myusername\Documents\MyImageFolder\My%20Image%20Name.png"
Change the paths with a text editor
Compress all the contents of the folder to a .zip
Change the extension to the original .xlsx or .xlsm
These steps could be automated with VBA, AutoIt, etc., here some references:
An example with AutoIt and 7-zip
http://www.jkp-ads.com/Articles/Excel2007FileFormat.asp
http://www.jkp-ads.com/Articles/Excel2007FileFormat02.asp
Ron de Bruin zip examples with VBA
Read and change multiple XML files in Excel (2007) VBA
Excel uses the Formula Bar as the link in this case, just the same as it would link between ranges in two different worksheets. When I select a linked picture, the formula below populates in the formula bar:
=[TrialWB.xlsm]Sheet1!$C$3:$E$6
You can access the Shape's formula using the code below and inserting your picture's specific name:
ActiveSheet.Pictures("Picture Name").Formula = "=[TrialWB.xlsm]Sheet1!$C$4:$E$6"
In updating the links, you'll have to change the file path in the formula. This might look like:
ActiveSheet.Pictures("Picture Name").Formula = "='C:\Reports2015\[TrialWB.xlsm]Sheet1'!$C$4:$E$6"
changing to
ActiveSheet.Pictures("Picture Name").Formula = "='C:\Reports2016\[TrialWB.xlsm]Sheet1'!$C$4:$E$6"
This question may be of some further assistance for accessing formulas:
Excel: create image from cell range
And here's a useful Microsoft page for formula file path editing: https://support.office.com/en-us/article/Create-an-external-reference-link-to-a-cell-range-in-another-workbook-c98d1803-dd75-4668-ac6a-d7cca2a9b95f
This question is in regards to this answer that was made a long time ago:
getting two A6 complete booklet sequences from an A4 page
I have been trying to create this imposed pdf for a long time using the script but nothing is happening.
First of all I am a n00b in anything related to scripting but can do it when its necessary.
Here is what I did:
I copied the script in text file and changed the extension to .ch and named it new.ch and changed the following values:
file=$1 multivalentpath=$2
to
file=$abc.pdf multivalentpath=$D:\Multivalent.
I put the multivalent.jar file, pdf file and the script in a single folder.
I wrote:
new abc.pdf multivalent relative path
but nothing happens. Can you please help me out here.
Masud
I really could use some help
I have two .txt/csv files that I need to read from into my excel file.
In my excel file I have a whole column, each cell containing string of characters and I need to write a script to be able find matches and and copy an adjacent column from that txt file.
An example of a single row on my txt file is shown below:
"AB101AA","AB10 1AA","AB101A","AB10 1A","AB101","AB10 1","AB10","AB10","AB","10",394251,806376,,
"AB101AF","AB10 1AF","ABERDEEN","ABERDEENSHIRE",,"ABERDEEN, CITY OF"
My excel file would have a cell which probably say "AB101AF" and i want the corresponding cell to run through a million rows and find the match and then find the corresponding nth cell on the txt file and return it on the excel spreadsheet example "ABERDEEN, CITY OF".
I know I havent been helpful in explaining the issue. But any help would be appreciated.
Thank you
Depending upon the size of your text file you could import the file using the GetExternalData option in Excel. This would allow you to load your data into a different Sheet and then use a lookup to your data from the main Sheet. Using Match and/or vlookup should help here.
You could also add a workbook connection to the text file and search using the connection.
Morning All,
I'm trying to come up with a solution to automatically update a excel report that's currently updated manually(SQL runs and copy and paste job). I've got a few idea's but i'm wondering if there is a way in SSIS that would manage it. Problem is I need to create a file with a specific format, logo at the top, text in line a2, report title a4 and then data a7, b7, c7 ect...
I need the file to update and save as a unique name on the 1st of each month, considered using a sql driven excel data source but then I would need to open, refresh and save. Don't really want to have a scheduled task to run on open and save vb script.
If anyone has any idea's that would be great!
The source file (.txt) looks like this:
F1, F2, F3
1, A1, A2
2, B1, B2
The first line has the field names.
Create your template file. Name it ReportTemplate.xlsx. Create a copy (for now manually) Reort.xlsx
A1: Logo Image
A2: Your Text
A4: Reoprt Title
A6: F1
B6: F2
B6: F3
Make sure there is nothing below line 6.
Now when you connect your source to the destination file (Report.xlsx), SSIS will automatically write from A7.
Once this is done, you would have to create a script task to copy this template to a file and name that file according to your requirement. The connection string for the destination would need to be dynamic. If you need help, please revert back.