阅读excel,在文本中搜索然后在单元格中写入 [英] Read excel, search in a text then write in a cell
问题描述
所以,首先,我有一个包含1行和多列的excel文件。
我需要读取一列文本。然后我必须在.txt文件中搜索该文本。在我找到文本的行上,我需要继续搜索MIN / MAX:。
这条线看起来像这样:
UInt32 StEaAktivKl15Pers_en / * LSB:2 ^ 0 OFF:0 MIN / MAX:0 .. 2 * /;。
excel单元格中的字符串,我正在搜索的是
StEaAktivKl15Pers_en。在我找到了这条线和MIN / MAX:之后,我需要在MIN之间做一个随机的,它是0,而MAX是2。
我必须将它写在Excel文件中,查找我正在搜索的那一列上的特定行数。
你能帮助我吗?它可以是C#,C ++,Python或Excel中的VBA。
我尝试过:
目前我可以从excel中读取并将值存储在变量中
So, for the beginning, I have an excel file with 1 row and multiple columns.
I need to read one column where is a text. Then I have to search for that text in a .txt file. On the line where I found the text I need to keep searching for "MIN/MAX:".
The line looks like these:
"UInt32 StEaAktivKl15Pers_en /* LSB: 2^0 OFF: 0 MIN/MAX: 0 .. 2 */;".
The string that is in excel cell and I'm searching for is
"StEaAktivKl15Pers_en". After I found the line and the "MIN/MAX:" I need to do a random between MIN which is 0 and MAX wich is 2.
And I have to write it in Excel file for a specific number of rows on that column I was searching for.
Can you guys help me with this? It can be in C#, C++, Python or the VBA from Excel.
What I have tried:
For the moment I can read from excel and store the value in a variable
推荐答案
在c#中实现它会更容易。
如果您的Excel文件保存为.CSV文件会更容易,但是如果您希望处理本机.xlsx文件,则可以使用可以找到的加载项这里。 [ ^ ]
然后,按照这些说明 [ ^ ]。
It will be easier to implement in c#.
It will be easier if your Excel file is saves as a .CSV file, however if you wish to process a native .xlsx file, you can use an add-on that can be found here.[^]
Then, follow these instructions[^].
这篇关于阅读excel,在文本中搜索然后在单元格中写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!