Compare Cells to Network Folder

Hello, I am new here and looking for some help, as I’ve been stuck on an issue…

I’ve been tasked with creating an app that requires me to compare a range of aspose cells in c# to an iteration of file names. if they don’t match, then I have to add said files name that only exist in the network folder, into the excel sheet.

I have a method that calls the list of file names from the network folder, and I also have the range of cells. Each individual thing returns it’s respective values. I just need a way to check if there are any that don’t exist in the other.

I’m lost on how to go about this, as everything I’ve tried has told me I cannot use “Cells” like I am - with values of int and bool.

I’m new to both C# and Aspose.Cells… so thank you for your patience in helping me get this figured out :slight_smile:

@mhepner101 Please allow me to clarify your issue:

Are you trying to determine whether a list of file names exists within a specific range of cells in a workbook? Alternatively, are you attempting to compare the contents of cells within a specified range in two or more different workbooks to check if they are identical?

Understanding the specific scenario will help me provide you with the most accurate and relevant assistance.

Hi! Thanks for your reply.

I am trying to compare a range of cells that comes from a workbook, to a list of file names that pulls from a network folder (the list is not in a workbook). I hope that helped clarify.

A question to help you, help me… is there a way to do that, where I am not comparing two workbooks? Or in order to compare the cell values, does it have to be compared with another workbook/sheet?

What I am trying to do is:

if network folder file name list (a string, not a workbook)
and
worksheet cells range values (a workbook)
do not contain all the same values,
then… add what is different in the network folder, to the worksheet

I am just wanting to know if it is possible to do it in the way I have been asked.

1 Like

@mhepner101,

Thanks for providing further details.

I guess you may make use of some Excel formulas for comparison/matching task. For example, you may try VLOOKUP/XLOOKUP and/or MATCH MS Excel’s formula(s). You may compare each individual string (which is coming from your custom method call for network folder list (names of the files)) to compare/match with the range of cells (e.g., you already have A2:A10 range/area in a worksheet). See the document on MS Excel functions/formulas for your complete reference.
https://support.microsoft.com/en-au/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929
https://support.microsoft.com/en-au/office/match-function-e8dffd45-c762-47d6-bf89-533f4a37673a

Both formulas (LOOKUP and MATCH) are supported by Aspose.Cells’ formula calculation engine (see the document on supported formulas/functions list by Aspose.Cells), so you may input the formula(s) into respective cell(s) to know which file names (from your custom list) are matching/not matching when comparing with your existing range in the worksheet. All you need to do is insert the file names (from your custom method call (network folder) into some cell(s) and then apply formulas accordingly. You can calculate formula(s) and get the results/resultant values at runtime by Aspose.Cells APIs, see the document for your reference.

Hope, this helps a bit.

1 Like

This is great information, thanks! I really appreciate your help and the links for reference. Good to hear I can use things I have a bit more experience with here :slight_smile:

Thank you!

@mhepner101,

You are welcome.