Author |
Topic |
|
belebele
4 Posts |
Posted - 10/29/2021 : 09:32:35 AM
|
Hello,
I use a data connector to import excel files containing several sheets. I want to copy two specific cells (B2 and C2 in the example below) of one of the sheets into a new worksheet where I gather all my results. However, when I copy those specific cells into the new worksheet, there is no value displayed "--". The problem comes obviously from the format of the imported cells.
Therefore, I would like to change the format of the imported cells automatically. In order to so, I have implemented a python code in "Set columns values". When my data is a number, it works well as you can see below. In the screenshot, I have simplified the structure of the sheet to make the issue clearer: (t refers to col(D) and tim to col(B)). The cell D1 contains now the value of B2 in the right format.
I am now trying to write another function to do the same with the date format in col(C) but I don't understand well what should I use in this case instead of "float". I have tried the following code but it doesn't work. t refers to col(E) and tim to col(C).
Do you have any suggestion to make this work?
I don't want to change the format of the cell directly in the excel file as I have a huge amounts of excel files to treat. Also, I am using a data connector to import those excel files quickly (they all have the same structure).
Thanks a lot for your help, Greg |
|
YimingChen
1621 Posts |
|
belebele
4 Posts |
Posted - 11/01/2021 : 10:51:01 AM
|
Thanks James for your reply.
I tried your code but I got the following error:
Maybe the format of my cells are slightly different from the one in your trial? My values (date and numbers) are left-aligned after importing them. |
|
|
cpyang
USA
1406 Posts |
Posted - 11/01/2021 : 12:53:01 PM
|
Left aligned means the column is holding text, not numeric, so you need to first fix how you put values into the worksheet.
CP
|
|
|
|
Topic |
|
|
|