Page 1 of 1
Xlsx to csv Running on Jenkins
Posted: 22 Mar 2018 06:46
by naraen87
Hi,
I've a script for xlsx to csv and also that is working fine for me in cmd prompt, while running the same script from Jenkins I'm getting a error like
Code: Select all
C:\Users\SVCT-WI-Jenkins\Desktop\Post_Patching\Mapping_Server\Excel2csv.vbs(9, 1) Microsoft Excel: Microsoft Excel cannot access the file 'C:\Users\SVCT-WI-Jenkins\Desktop\Post_Patching\Mapping_Server\WI_non_cluster_server_list.xlsx'. There are several possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook
Is anyone please help me on this.
Re: Xlsx to csv Running on Jenkins
Posted: 22 Mar 2018 09:08
by Squashman
We really don't do Jenkins support here. If you have a specific question about jscript, vbscript or batch files, please post the code and ask a question about it.
Re: Xlsx to csv Running on Jenkins
Posted: 22 Mar 2018 13:32
by ShadowThief
That's a pretty straightforward error message. The file either doesn't exist or is currently open somewhere.
Re: Xlsx to csv Running on Jenkins
Posted: 23 Mar 2018 06:43
by SIMMS7400
I just ran into this issue last week when trying to execute a batch process which called multiple VB Scripts via TIDAL Scheduler (same concept as Jenkins).
Have a look at this link and add the correct path provided based on your machine and add appropriate permission to the "Desktop" folder. Then re-execute. I'd bet this week's pay that's your issue.
https://stackoverflow.com/questions/710 ... esheet-app
When you read it, read the WHOLE thing. Keep in mind this tidbit of information:
Code: Select all
The point is that WOW64 stands for Windows on Windows64, that means it actually applies for 32-bit programs running on the 64bit OS.
Since I have 64-bit Excel installed, the proper directory turned out to be the c:\windows\system32\config\systemprofile\desktop
Here is my XLSX to CSV conversion vb script:
Code: Select all
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::-- Script Name: XLSX_2_CSV.vbs
'::--
'::-- Description: This script converts *.xls* files to *.csv
'::
'::
'::-- Calls:
'::-- Called By: HC_SUBMSSN_PUBLISH.cmd
'::
'::-- Parameters: Called by HC_SUBMSSN_PUBLISH to get arguments to determine:
'::--
'::-- 1. Input Name
'::-- 2. Output Name
'::
'::
'::-- Author: Joe Shmoe
'::-- Date: 06/13/17
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Set objExcel = CreateObject("Excel.application")
objExcel.application.visible=false
objExcel.application.displayalerts=false
'::-- Identify Args passed in from batch file --::'
Set objArgs = WScript.Arguments
InputName = objArgs(0)
OutputName = objArgs(1)
'::-- Open *.xls* files and save-as *.csv --::'
set objExcelBook = objExcel.Workbooks.Open(InputName)
objExcelBook.SaveAs OutputName, 51
objExcel.Application.Quit
objExcel.Quit
Let us know - thanks!