Forum Discussion
Excel import not consistently recognising blank first column
- 1 year ago
Thanks - I tried setting InferSheetDimensions to false but you're right it still uses excel's used range. I don't have control over the file creation unfortunately but I can interfere if a file is recieved and breaks the flow. A bit faffy - hopefully a feature to control the import is added soon. Thanks!
Could you please share the M code that you're using? You can get it by going into the "Advanced editor" of your query in the "View" tab. If you're using a function to drive the logic, please share that custom function as well
Hi Miguel and thanks for replying - it's actually the very first step, i.e. let Source = Excel.Workbook(Parameter, null, true), Navigation = Source{[Item = "Sheet1", Kind = "Sheet"]}[Data].
When the Gen 2 Flow imports the spreadsheet, it automatically determines which column (A or B in this case) should be "Column1" based on what Excel indicates is the 'used range' on the sheet. If column A is blank, usually it decides column B should be Column1. The problem I'm having is that for some sheets, even though column A is blank in all of them, it's setting column A as Column1 in some files and column B in others.
- Ehren1 year ago
Microsoft Employee
The two files likely have different "used range" dimensions. There are instructions for how to inspect the dimensions here:
https://learn.microsoft.com/en-us/power-query/connectors/excel#how-to-diagnose-incorrect-dimensions
If you control the creation of the files, you may be able to remedy this by clearing any formatting/values/etc. from the first column. Even though the cells are blank, there may be some formatting or other metadata that's causing them to be included in the dimensions.
Alternatively, you could edit the first column in all the files to include something (even just a space) so that they're all consistent in having the real data start in Column2.
You could also try using the InferSheetDimensions option of Excel.Workbook. I don't recall if it will ignore leading null cells, but it would be worth a try.
- poinfrettia1 year agoFrequent Visitor
Thanks - I tried setting InferSheetDimensions to false but you're right it still uses excel's used range. I don't have control over the file creation unfortunately but I can interfere if a file is recieved and breaks the flow. A bit faffy - hopefully a feature to control the import is added soon. Thanks!
- Anonymous1 year agoNot applicable
Hi poinfrettia ,
Just checking in — has your issue been resolved? 😊
If so, it would be great if you could share the steps or the final solution you followed, so others facing a similar issue can benefit from it as well.
Also, please consider marking it as the accepted solution if it helped, this really helps the community!
Regards,
B Manikanteswara Reddy