Create VBScript to extract formulas from an Excel doc

Avg Bid (USD)
Project Budget (USD)
$30 - $250

Project Description:
The purpose is to create a VBScript program that can be run from the windows command line. The command will invoked like this:

cscript.exe ExtractExcelValues.vbs target_file.xlsx last_cell_address output_filename.csv

target_file.xlsx - name of a valid Microsoft Excel file with multiple sheets
last_cell_address - excel cell name such as B27 or AJ43 which is the bottom right cell to be scanned
output_filename.csv - name of file to send output results (overwrite if file already exists)

The script should produce a CSV formatted text output file that contains one row in the output file for each numeric or formula cell in the excel document. Blank cells or cells that contain text or mixed text and numbers are not written to the output file.

The format of the output CSV file has three columns:


sheet_name - name of the sheet where this cell is found
cell_address - numeric address of the cell such as K15
number_or_formula - displays the formula text if a formula is used or numeric value if the cell does not contain a formula

The script should scan each Worksheet in the Excel document. For each sheet it should scan all the cells from A1 to the "last_cell_address" passed in on the command line. For example, if the last cell address were given as "C3" then the script should scan A1, A2,A3,B1,B2,B3,C1,C2,C3 of each worksheet in the document. As mentioned above, if a cell does not contain a number or a formula, it should not be sent produce a row in the output file.

The developer will need to have Microsoft Excel installed on their computer to be able to write this program because the user will have to use CreateObject("Excel.Application") in order to open the Excel file. At the bottom of this description is the code for a similar VBScript program that shows most of what needs to be done (although the code is not exactly correct).

FOR REFERENCE: - VB Script reference - Using VBScript from the command line via Windows Scripting Host - Microsoft's object model for Microsoft Excel


sub main()
dim app
set app = CreateObject("Excel.Application")
app.Visible = False ' Hide the application while this script is running

dim fso
set fso = CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(wscript.arguments(0)) then
msgbox "Fatal Error! Unable to locate specified file:" & vbcrlf & _
wscript.quit -1
end if
dim doc_path,workbook
dim sheet_name, cell_address, value, formula, cell
doc_path = fso.GetFile( Wscript.Arguments(0)).Path
set workbook= app.Workbooks.Open (doc_path)
For Each sheet In workbook.Worksheets
sheet_name = sheet.Name
Set cell = sheet.Range("A1")
value = cell.Value
formula = cell.Formula ' Need code to handle when the Formula is Null indicating no formula
msgbox sheet_name & vbCrLf & "A1: " & value & vbCrLf & formula
end sub

Please do not offer to build this program in Visual Basic. It must be built in Visual Basic Script (VBS).

Skills required:
Excel, Microsoft, Visual Basic
About the employer:
Public Clarification Board
Bids are hidden by the project creator. Log in as the employer to view bids or to bid on this project.
You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.

$ 89
in 0 days
$ 55
in 0 days
Hire mrbrave
$ 64
in 0 days
Hire microk
$ 50
in 3 days
$ 55
in 3 days
$ 138
in 3 days
$ 30
in 1 days
$ 250
in 5 days
$ 154
in 2 days
Hire eugene2006
$ 30
in 2 days