Question

Excel dynamically Data grid view

How to fetch the all values present in the Excel dynamically by using Data grid view in Automation.

Thanks&Regards

Anil.

Comments

Keep up to date on this post and subscribe to comments

January 9, 2019 - 7:36pm

There is an easy to follow example on page 12 here in this Pega provided link:

https://community.pega.com/knowledgebase/documents/using-microsoft-office-connectors

 

 

January 10, 2019 - 3:52am
Response to anthonymcgriff

Yeah but where can we get the property columngetletter in excel?

-

January 11, 2019 - 1:26am

public string GetExcelColumnName(int columnNumber)
{
    int dividend = columnNumber;
    string columnName = String.Empty;
    int modulo;

    while (dividend > 0)
    {
        modulo = (dividend - 1) % 26;
        columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
        dividend = (int)((dividend - modulo) / 26);
    } 

    return columnName;
}

 

I have found this script to get excel dynamically. Could you please explain me why 65 is added to modulo variable?

January 11, 2019 - 7:38am
Response to Anilkumark3888

@Anilkumark3888

If you look at an ASCII table, you'll see that uppercase A-Z are encoded starting at position 65.