Jump to content

Excel Date Format in Array


Recommended Posts

Hello all,

I am copying data from a .csv file to another excel file using _ExcelReadSheetToArray().

Problem is, that when I am reading the dates from the .csv file (i.e. 30.06.2010) to the array, the format is changed and the value in the array (as displayed with _ArrayDisplay() is "20100630000000".

This means, that when I am inserting the data to another excel file, I cannot compare the different dates. I tried re-creating the dates in the new sheet using =Concatenate() (in Excel), but the result is only formatted as text.

Does anyone have a fix for this problem?

Thank you very much

Link to comment
Share on other sites

You can create a copy of the function (rename it to avoid confusion) and change the method used to read the cells from .value to .text, for example:

; Old line:  $avRET[$r][$c] = $oExcel.Activesheet.Cells($iStartRow + $r - 1, $iStartColumn + $c - 1).Value
$avRET[$r][$c] = $oExcel.Activesheet.Cells($iStartRow + $r - 1, $iStartColumn + $c - 1).Text

The value is the way Excel saves that data type. The text is the way it presents it on the sheet.

:blink:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...