Do Excel formulas continue to work after being imported into a Datagridview?

Asked

Viewed 38 times

0

I have a spreadsheet in Excel where I import it, to present the data in a DataGridView, i wonder if the formulas that are contained in the spreadsheet still work in the DataGridView.

To be more specific the formula that I would like to keep running, or be implemented in some other way, is basically a subtraction of dates, where I must subtract today’s date from the effective date (which is a fixed date) and show the amount of months between these dates in a new cell.

I am importing the spreadsheet to the bank manually, by , and I retrieve that information to DataGrid through a SELECT.

Import by Workbench

LOAD DATA LOCAL INFILE  
'importexcel/testeimport_utf.csv'
INTO TABLE MINHA TABELA character set utf8 
FIELDS TERMINATED BY ';' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
(CAMPOS DA TABELA);

I believe that there is no way to implement an Excel formula through Mysql, but I would like to know if I could insert this formula in DataGrid in some other way, because otherwise months will pass, and the column showing amount of months will remain static.

  • 1

    A database is not a spreadsheet. DBMS does not have a data type that is a formula. All data in each column belongs to a single domain. It is possible to apply functions to the selected data from your database, you will have to search among the existing functions which suit your needs.

  • I get it, I’m going to do some research on functions that can perform this operation. I would sincerely like to do this through C# myself but I have no idea how to manipulate static data on a Grid.

1 answer

2

Mysql cannot "interpret" the formulas made in excel, the solution is: Create a VIEW in Mysql by calculating the dates :

timestampdiff(MONTH,SuaColuna,now()) AS TEMPO_DECORRIDO_MINUTOS
  • The timestampdiff() can really do this job, I’ll see if I can fit it in the best way possible in my problem, great suggestion. But in the case there you put MINUTE but I want the months so in case it would be MONTH in response.

  • Yes, I put it in minutes as an example, but depending on the situation it becomes easier to work in minutes.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.