I'm being sent many spreadsheets which contain data that needs to be imported into a database, but many of these sheets contain rows with values missing in a certain column.

Ideally these "malformed" rows would be excluded from the export (rather than removed afterwards from the database). Is there a way either to filter before export, or to populate a second sheet using something like this statement?

SELECT * FROM sheet1 WHERE [sheet1.column-reference] IS NOT NULL

If you have ms access, you can simply map sheet as external table or create view with xls sheet as source table

SELECT * FROM [Excel 8.0;HDR=Yes; Database=C:\Folder\Workbook.xls;].[SheetName]

If you have many sheet you can do this by vba script, but this is programming task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.