Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 236 characters in body
Source Link
GWLlosa
  • 24.6k
  • 18
  • 83
  • 119

If you mean that you want to read one sheet, filter the results, and then write out another sheet, I'd suggest you:

  1. Read all the data from the sheet into memory (assuming its not excessively large).

  2. Use LINQ or vanilla C# to filter the data, (I'd recommend LINQ's ".Where()" and ".Distinct()" operators myself).

  3. Use the Excel API to write the data that remains into a new sheet.

If the spreadsheet(s) are very large, then you'll probably be best served by reading them into a database of some sort, and then relying on it for the filtration. You can use MS Access or SQLite as a small dedicated DB if you need.

If you mean that you want to read one sheet, filter the results, and then write out another sheet, I'd suggest you:

  1. Read all the data from the sheet into memory (assuming its not excessively large).

  2. Use LINQ or vanilla C# to filter the data, (I'd recommend LINQ's ".Where()" and ".Distinct()" operators myself).

  3. Use the Excel API to write the data that remains into a new sheet.

If you mean that you want to read one sheet, filter the results, and then write out another sheet, I'd suggest you:

  1. Read all the data from the sheet into memory (assuming its not excessively large).

  2. Use LINQ or vanilla C# to filter the data, (I'd recommend LINQ's ".Where()" and ".Distinct()" operators myself).

  3. Use the Excel API to write the data that remains into a new sheet.

If the spreadsheet(s) are very large, then you'll probably be best served by reading them into a database of some sort, and then relying on it for the filtration. You can use MS Access or SQLite as a small dedicated DB if you need.

Source Link
GWLlosa
  • 24.6k
  • 18
  • 83
  • 119

If you mean that you want to read one sheet, filter the results, and then write out another sheet, I'd suggest you:

  1. Read all the data from the sheet into memory (assuming its not excessively large).

  2. Use LINQ or vanilla C# to filter the data, (I'd recommend LINQ's ".Where()" and ".Distinct()" operators myself).

  3. Use the Excel API to write the data that remains into a new sheet.