Forum Discussion

jujredon9090's avatar
jujredon9090
Copper Contributor
Feb 06, 2020

Problem with Excel importing CSV file

Hi,

 

I'm struggling with Excel while refreshing a data import connection and maybe someone can help me.

 

I have imported a csv file with headers and several columns. Adjacent to those columns, I have some formulas and have set the corresponding checkbox so whenever that I refresh the import, adjacent formulas are copied to the new data added. While importing, I skip the header line and start importing in row 2.  I've also defined a named range for the returned data so it contains rows and columns corresponding to data imported.

 

I usually receive new versions of the csv file so it might contain more or less rows... and whenever I refresh, data is imported correctly and everything works fine...

 

However, when I have a file that is empty and it only contains the header row, if I refresh the data connection I can see that it does not work as I would expect:

 - Range corresponding to returned data compress reduces to just one cell. I would expect that refers to the first empty imported row...

 - Formats disappear except for the first cell of the range. I would expect to keep existing format for first data row

 - emtpy cells appear between the first cell in range and the column I have with adjacent formulas...

 

The problem is that if I then update the csv file containing data (other than header)...  formulas in adjacent column are not copied across all the rows that appear on the updated file.... it looks like Excel does not identify that formulas are adjacent to range... because range was reduced to one cell...

 

I've tried with 3 options 'Insert cells for new data, delete unused cell', 'Insert entire rows for new data, clear unused cells' and 'Overwrite existing cells with new data, clear unused cells' and none of them recovers the behaviour I had before importing en empty file...

 

I know that one possible solution would be to check if file is empty before refreshing with VBA... but I wonder if there is any other option rather than using VBA

 

Any thoughts?

 

Thanks!

 

 

No RepliesBe the first to reply

Resources