Running a script in an .csv file
I have an excel .csv I need to apply formatting to each time it is opened.
The file has 1 query to pull data from a .txt file
Take the data and display in appropriate columns
Use a macro ( or script ), to check data in columns
Display query data in a cell to be read by another program looking for data in that cell
This is a job for Excel and not for scripting. Post your request in the Office Excel forum. They will help you learn Excel.
If you want to do this programtically then you will need to start by learning a scripting language. I recommend PowerShell.
Most formatting of documents is done with a template. This would be applied when creating your document.
Start by learning Excel then look into PowerShell. You can alos look int he repository for samples of using Excel with PowerShell.
http://gallery.technet.microsoft.com/
http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
¯\_(ツ)_/¯
Similar Messages
-
How do I run a script on a .indb file?
How do I run a script on a .indb file? What should I do differently than in running one on a single indd file?
I do this like so:
var inddFiles = GetFilesFromBook();
for (var i = 0; i < inddFiles.length; i++) {
inddFile = inddFiles[i];
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
doc = app.open(inddFile);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
// Process document
doc.close(SaveOptions.YES);
function GetFilesFromBook() {
var bookContent, file,
activeBook = app.activeBook,
files = [];
for (var i = 0; i < activeBook.bookContents.length; i++) {
bookContent = activeBook.bookContents[i];
if (bookContent.status != BookContentStatus.MISSING_DOCUMENT) {
file = new File(bookContent.fullName);
files.push(file);
return files;
Here is the whole script that you can use as example. -
Hi,
I am running Data-Driven test on different machines with different input values in .CSV file in batch mode.we are facing following problem:
Test not considering modified values in .CSV file until we recompile the test.
Is there any way to avoid this dependency of compilation after updating .CSV file???
Regards,
Nagasree.Assuming the CSV is part of the Visual Studio solution. Open the properties panel for the CSV file from solution explorer. Set "Copy to output directory" to "Copy if newer" or to "Copy always". Some documents recommend
"Copy if newer" but I prefer "Copy always" as occasionally a file was not copied as I expected. The difference between the two copy methods is a little disk space and a little time, but disks are normally big and the time to copy is normally
small. Any savings are, in my opinion, far outweighed by being sure that the file will be copied correctly.
See also
http://stackoverflow.com/questions/23469100/how-to-run-a-test-many-times-with-data-read-from-csv-file-data-driving/25742114#25742114
Regards
Adrian -
Running out of memory building csv file
I'm attempting to write a script that does a query on my
database. It will generally be working with about 10,000 - 15,000
records. It then checks to see if a certain file exists. If it
does, it will add the record to an array. When its done looping
over all the records, it takes the array that was created and
outputs a csv file (usually with about 5,000 - 10,000 lines).
But... before that ever happens, it runs out of memory. What can I
do to make it not run out of memory?quote:
Originally posted by:
nozavroni
I'm attempting to write a script that does a query on my
database. It will generally be working with about 10,000 - 15,000
records. It then checks to see if a certain file exists.
Sounds pretty inefficient to me. Is there no way you can
modify the query so that it only selects the records for which the
file exists? -
Error: run postflight script for adobe common files
error: run postflight script for adobe common files
I am sorry can you please restate your inquiry. If you can provide some more details regarding which Adobe Software you are inquiring about? Which operating system are you using? Finally what are you trying to accomplish when you receive this error?
-
Need to run powershell script in a bat file
I have a ps1 file with the following:
Get-ADUser -Filter * -SearchBase "ou=<HOSPOU>,ou=Domain Users and Groups,dc=<hospdomain>,dc=local" -Properties Description,EmailAddress| Select-Object -Property Name,SamAccountName,Description,EmailAddress|Export-Csv "\\<server>\home2$\information
services\IS STAFF\Documentation\AD Info\smcusers.csv";
I have a bat file:
@ECHO OFF
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%smcusers.ps1
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command import-module ActiveDirectory "%PowerShellScriptPath%";
But while it launches powershell with the AD module, It apparently cannot read the ps1 file.
I get:
H:\>C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command i
mport-module ActiveDirectory "H:\smcusers.ps1";
Import-Module : A positional parameter cannot be found that accepts argument 'H
:\smcusers.ps1'.
At line:1 char:14
+ import-module <<<< ActiveDirectory H:\smcusers.ps1;
+ CategoryInfo : InvalidArgument: (:) [Import-Module], ParameterB
indingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
.Commands.ImportModuleCommand
I have tried to modify the parameters
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command import-module ActiveDirectory -File "%PowerShellScriptPath%";
Still no luck.
I need to be able to run this as a scheduled task.
Karon WApparently I don't know where to put everything.
I have a single line:
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit import-module ActiveDirectory; -Command {Get-ADUser -Filter * -SearchBase "ou=Shannon Memorial,ou=Domain Users and Groups,dc=shannonhealth,dc=local" -Properties Description,EmailAddress|Select-Object
-Property Name,SamAccountName,Description,EmailAddress|Export-Csv "\\svr-resource2\home2$\information services\IS STAFF\Documentation\AD Info\smcusers.csv"}
This is the response:
H:\>C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit import-mod
ule ActiveDirectory; -Command {Get-ADUser -Filter * -SearchBase "ou=Shannon Memo
rial,ou=Domain Users and Groups,dc=shannonhealth,dc=local" -Properties Descripti
on,EmailAddress | Select-Object -Property Name,SamAccountName,Description,Email
Address | Export-Csv "\\svr-resource2\home2$\information services\IS STAFF\Docu
mentation\AD Info\smcusers.csv"}
'Select-Object' is not recognized as an internal or external command,
operable program or batch file.
I modified to 2 lines:
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit import-module ActiveDirectory;
Get-ADUser -Filter * -SearchBase "ou=Shannon Memorial,ou=Domain Users and Groups,dc=shannonhealth,dc=local" -Properties Description,EmailAddress|Select-Object -Property Name,SamAccountName,Description,EmailAddress|Export-Csv "\\svr-resource2\home2$\information
services\IS STAFF\Documentation\AD Info\smcusers.csv"
This is the response:
H:\>C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit import-mod
ule ActiveDirectory;
PS H:\> exit ************I had to type*****************
H:\>Get-ADUser -Filter * -SearchBase "ou=Shannon Memorial,ou=Domain Users and Gr
oups,dc=shannonhealth,dc=local" -Properties Description,EmailAddress | Select-O
bject -Property Name,SamAccountName,Description,EmailAddress | Export-Csv "\\sv
r-resource2\home2$\information services\IS STAFF\Documentation\AD Info\smcusers.
csv"
'Get-ADUser' is not recognized as an internal or external command,
operable program or batch file.
If I paste the command in before I type exit, it works.
If I paste:
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit import-module ActiveDirectory;
I am put in the ad powereshell
Then I paste:
Get-ADUser -Filter * -SearchBase "ou=Shannon Memorial,ou=Domain Users and Groups,dc=shannonhealth,dc=local" -Properties Description,EmailAddress|Select-Object -Property Name,SamAccountName,Description,EmailAddress|Export-Csv "\\svr-resource2\home2$\information
services\IS STAFF\Documentation\AD Info\smcusers.csv"
and I get the expected output.
What do I need to have in the bat file so the 2nd line of the script will run? and where does it go?
Karon W -
Deployment failing when running .bat script or command line file package
HI Guys,
I am trying to run a .bat file on a client using a program. My data source point to the script's folder.
I keeps failing with error 1.
I have trying making run in 64-bit using this without luck: http://madluka.wordpress.com/2012/09/24/configmgr-2012-64bit-file-system-redirection-bites-again/
Here is the content of my .bat file:
@ECHO OFF
IF NOT "%PROCESSOR_ARCHITEW6432%"=="AMD64" GOTO native
ECHO "Re-launching Script in Native Command Processor..."
%SystemRoot%\Sysnative\cmd.exe /c %0 %*
EXIT
:native
ECHO "Running Script in Native Command Processor..."
c:\
cd c:\windows\System32
start cmd.exe /c shutdown -l
stop
I will get the same error when running a simply command line as well. Instead of a .bat file.
any ideas?Maybe this will help you:
http://blog.coretech.dk/kea/configuration-manager-shutdown-utility
This instead of using "shutdown.exe -l" command. This tool can be used for logoff also. Hope it helps!
My blogs: Henk's blog and
Virtuall | Follow Me on:
Twitter | View My Profile on:
LinkedIn -
Automating Export/Import of CSV Files
Thought I would ask here for any advice or suggestions because my knowledge is lacking in this area a bit.
What I need:
An automated process, whether it be 3rd party s/w or a cron job, that can export a few tables to csv's and then xfer the file to another server.
At this point i will need a process that can take that csv and automatically load it into a different oracle DB.
Any suggestions on good software to use or scripts to run would be a great start to my research. thanksHello,
You can simply write some sql scripts to generate csv file and you can connect from remote server to run this sql scripts and it will generate csv file on target server. What you need to do is configure your tnsnames.ora to connect to your source server from target server. Meaning from target server you should be able to sqlplus in.
#target server
$> sqlplus username/password@source_db
sqlplus > test.sqlNow you can write shell script and here is a function which you can extend and call different sql script to generate csv file.
function exesqlfile{
typeset sqlfile=$1
if [ ! -f $sqlfile ]
then
echo "sql extraction file doesn't exist....";
echo "Exiting..."
exit 1;
fi
echo "
set feedback off
set verify off
set heading off
set pagesize 0
whenever sqlerror exit 1
whenever oserror exit 2
@$sqlfile
exit 0
" | sqlplus -s $username/$password@$source_db
tbl_x_ret_code=$?
if [ $tbl_x_ret_code -eq 0 ]
then
return 0;
else
return 1;
fi
}Regards
OrionNet -
Uploading & Processing of CSV file fails in clustered env.
We have a csv file which is uploaded to the weblogic application server, written
to a temporary directory and then manipulated before being written to the database.
This process works correctly in a single server environment but fails in a clustered
environment.
The file gets uploaded to the server into the temporary directory without problem.
The processing starts. When running in a cluster the csv file is replicated
to a temporary directory on the secondary server as well as the primary.
The manipulation process is running but never finishes and the browser times out
with the following message:
Message from the NSAPI plugin:
No backend server available for connection: timed out after 30 seconds.
Build date/time: Jun 3 2002 12:27:28
The server which is loading the file and processing it writes this to the log:
17-Jul-03 15:13:12 BST> <Warning> <HTTP> <WebAppServletContext(1883426,fulfilment,/fu
lfilment) One of the getParameter family of methods called after reading from
the Serv
letInputStream, not merging post parameters>.
Anna Bancroft wrote:
> We have a csv file which is uploaded to the weblogic application server, written
> to a temporary directory and then manipulated before being written to the database.
> This process works correctly in a single server environment but fails in a clustered
> environment.
>
> The file gets uploaded to the server into the temporary directory without problem.
> The processing starts. When running in a cluster the csv file is replicated
> to a temporary directory on the secondary server as well as the primary.
>
> The manipulation process is running but never finishes and the browser times out
> with the following message:
> Message from the NSAPI plugin:
> No backend server available for connection: timed out after 30 seconds.
>
>
>
> --------------------------------------------------------------------------------
>
> Build date/time: Jun 3 2002 12:27:28
>
> The server which is loading the file and processing it writes this to the log:
> 17-Jul-03 15:13:12 BST> <Warning> <HTTP> <WebAppServletContext(1883426,fulfilment,/fu
> lfilment) One of the getParameter family of methods called after reading from
> the Serv
> letInputStream, not merging post parameters>.
>
>
It doesn't make sense? Who is replicating the file? How long does it
take to process the file? Which plugin are you using as proxy to the
cluster?
-- Prasad
-
CSV File Doesn't Get Included In The Package
Hello friends,
We have problem with packaging the indesign document.
we are opening have data merge CSV files which show in the links pallet.
when we run the package command the .csv file doesn’t get included in the package
so if there are any extra settings that copies .csv files in the current package please help me.
Regard
TahirHi
And how about this technet article
http://technet.microsoft.com/en-us/library/ff980461(v=exchg.141).aspx
To avoid this error in the future, follow one or more of these steps:
Do not manually modify message tracking log files. By default, these files are located in the following directory: C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\MessageTracking.
Make sure that your file-based antivirus software is configured to exclude file directories that contain message tracking log files. For more information about configuring your file-based antivirus software on an Exchange server, see
File-Level Antivirus Scanning on Exchange 2010.
Review the System log for disk-drive-related events. Use the information in those events to determine whether the disk that stored the log files has any hardware failures. You may have to use
CHKDSK tool to check a disk and display a status report. For more information about
CHKDSK, type CHKDSK /? at a command prompt.
Cheers
Zi Feng
TechNet Community Support -
How to run shell script using External Process in Process Flow?
Hi,
We can run external process using Process flow.
I would like to run shell script as external process in Process flow.
Could any one please explain it?
Thanks and regards
Gowtham Sen.HI,
As you said I tried this case. I got the following error. The script is running successfully while I tested at unix command prompt.
The error is as follows..
tarting Execution PFPS_SMPL_RUNSHELL
Starting Task PFPS_SMPL_RUNSHELL
Starting Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS
/SOURCE_FILES/CollectFiles.sh: line 1: ls: command not found
/SOURCE_FILES/CollectFiles.sh: line 1: wc: command not found
/SOURCE_FILES/CollectFiles.sh: line 1: ls: command not found
Completing Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS
Starting Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS_1
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Sep 29 22:57:39 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[<password>][@<connect_identifier>] | /
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where <logon> ::= <username>[<password>][@<connect_identifier>] | /
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
Completing Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS_1
Completing Task PFPS_SMPL_RUNSHELL
Completing Execution PFPS_SMPL_RUNSHELL
My scenario is---
I am trying to return a file name from one shell script. I created a external process for that. After completion of this process, I am running another script which takes that file name and trying to create a external table. The both scripts are runnning successfully. But while I am trying to run using process flow, its not coming.
And I am not getting the way to catch the output of external process and pass it as parameter as another external process.
Any suggestions are welcome.
Thanks and regards
Gowtham Sen. -
Scripts / Export Layers to Files / Include Background Layer
Running the script Export Layers to files.
Need to keep one layer on that is applied to all the layers (I have a stroke on the top layer I would like applied to all the images that are saved out.)
How do I modify the script for this?
Thanks!
KenAdapting that Script might be somewhat difficult as it is pretty bulky.
But if its always the topmost layer thats supposed to stay visible and You know which format You want to save the resulting files to beforehand something much smaller may suffice.
You might try this, but I havent tested it extensively:
#target photoshop;
var myDocument = app.activeDocument;
// get the name and location;
var docName = myDocument.name;
var basename = docName.match(/(.*)\.[^\.]+$/)[1];
var docPath = myDocument.path;
// get the artlayers and remove the topmost;
var allArtLayers = collectLayers(myDocument);
var theTopmost = allArtLayers.pop();
// hide all but the topmost layer;
for (var n = 0; n < allArtLayers.length; n++ ) {
allArtLayers[n].visible = false
for (var m = 0; m < allArtLayers.length; m++ ) {
// show the layer;
allArtLayers[m].visible = true;
// tiff options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS ;
tifOpts.layers = true;
// duplicate the image;
var thecopy = myDocument.duplicate (thecopy, true);
// save copy;
thecopy.saveAs((new File(docPath+"/"+basename+" "+allArtLayers[m].name+".tif")),tifOpts,true);
thecopy.close(SaveOptions.DONOTSAVECHANGES);
// hide the layer again;
allArtLayers[m].visible = false
//thats it; thanks to xbytor;
////// collect all artlayers //////
function collectLayers (theParent) {
if (!allArtLayers) {
var allArtLayers = new Array}
else {};
for (var m = theParent.layers.length - 1; m >= 0;m--) {
var theLayer = theParent.layers[m];
// apply the funtion to layersets;
if (theLayer.constructor == ArtLayer) {
allArtLayers = allArtLayers.concat(theLayer)
else {
allArtLayers = allArtLayers.concat(collectLayers(theLayer))
return allArtLayers -
Run Powershell Script from Server
I am new to MDT so please forgive me. I am looking for a way for the MDT server to run a script locally after a server has been deployed. I saw you can do something similar where you use remoting in the task sequence. That is not
allowed or enabled in my environment. Is there any way for the MDT server to know it is done then it runs a script?The unattend file has several locations that scripts could be run from, either in the specialize pass or oobeSystem pass.
http://technet.microsoft.com/en-us/library/cc748874(v=ws.10).aspx -- this also gives you some demos on how to create your own unattend, though most basic settings are handled by
MDT.
You could also look into utilizing the run and runonce keys -
http://msdn.microsoft.com/en-us/library/aa376977%28v=vs.85%29.aspx -
Is it possible to run a script each time a .CSV file is updated?
I am having trouble with a script I am trying to write, which is made up of two parts:
A .CSV file generated by PHP/MySQL whenever an RSS feed is updated. The contents of the .CSV are overwritten each time the PHP runs.
A DataMerge script, written in JavaScript.
What I would like to do is run the DataMerge script each time the .CSV file is updated. Is this possible, perhaps using an Event Listener within the PHP to trigger the DataMerge script? Or am I approaching this in the wrong way? I'm grateful for any thoughts you might have. Thanks, F.H.I would use Rorohiko's APID ToolKit: http://www.rorohiko.com/wordpress/indesign-downloads/active-page-item-developer/
It has fileChanged event that is sent after the observed external file has changed.
sorry guys for "labouring the point", but I'm working on very advanced project - and I need to know what my tool can or can't do
and in this case - using APID will break point 2.3 of EULA, right ? interaction with external datasource - without user action ?
robin
www.adobescripts.co.uk -
Import From CSV File statement runs forever, no error, does not finish
Hello,
I am trying to import a CSV file in a JAVA program, with the following statement:
IMPORT FROM CSV FILE '/debug/testdatabase/FILE.csv'
INTO "JOSEPH"."TEST_TABLE"
WITH COLUMN LIST IN FIRST ROW
RECORD DELIMITED BY '\n'
FIELD DELIMITED BY '\t' ERROR LOG '/debug/testdatabase/file.err'
THREADS 10
BATCH 10000
I have two HANA instances on different machines A and B:
Both machines run HANA version 1.00.74.00.389160 (NewDB100_REL), while the OS is
SUSE Linux Enterprise Server 11.1 on machine A and
SUSE Linux Enterprise Server 11.2 on machine B.
The statement above runs fine on machine A and the rows are imported properly from JAVA as well as when executed from HANA Studio SQL console.
If I copy the file to machine B and try the exact same statement with the same file, it does not finish (neither from JAVA nor from HANA Studio SQL console). There is no error either. It cannot be cancelled, only a HANA restart stops the statement. Also the sample file I use has only 2 rows, and memory does not seem to be a problem.
I seem to have a similar problem to the one described here, but the answers there do not help me: http://scn.sap.com/thread/3396582 I specified the record delimiter, and I used a python script to check for any strange characters that are not supposed to be there, but didn't find any.
If I copy the file to my windows PC and use the "File Menu -> Import -> SAP Hana Content -> Data from Local file" function, it imports the file correctly into B, but I need to be able to do it from JAVA.
Machine A administration view:
Machine B administration view:
If you have any idea what might cause this behavior or where I can find more information on this problem please give me a hint.Hi Joseph,
First from the pics, the revision of your SAP HANA instance is 73 instead of 74. Since I have no identical environment, I cannot test it for you. But can you try the simplest scenario? You can create a table with only one column table try to import a CSV file with only one row.
Best regards,
Wenjun
Maybe you are looking for
-
How to display a short term lock in a view?
Hello, I discovered recently the two checkin/checkout modes in sharepoint. The long term ckeckout that the user choose explicitly to have and the short term check out when the user open an office document for modification. This article describe the d
-
Brand new snowleopard - mp3's refuse to import!!
i just unwrapped my brand new imac today, and already i'm having trouble. i have tried dragging .mp3's into i-tunes, double clicking on them, importing them, dragging them into the folder ect ect..... i can't get a single mp3 to import into the libra
-
Cannot sync iPhone 4s with iTunes 11.1.4.62
I just updated to iTunes 11.1.4.62 and now I can't sync iPhone 4s. In fact, iTunes now does not recognize that iPhone is even connected under DEVICES. Was working fine before this iTunes update.
-
I need to know as to how to load a properties file recursively from inside a class file recursively looking for it from the the concerned class till the top pf package hierarchy.Ofcourse if i have my properties file at the root of my package hierarch
-
Hi all, hope you having a good time. I have a question about the procedure for PGW patch upgrade, I will perform an upgrade for version 9.7(3) and it is my first time so I need to know if the system has never been patched, do I have to apply all the