<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 連接到工作簿 在讀取/寫入活動工作表的數據時,您不需要工作簿對象: ~~~ >>> import xlwings as xw >>> xw.Range('A1').value = 'something' ~~~ ## Python to Excel 連接到工作簿的最簡單方法是由`xw.Book`提供:它在所有應用程序實例中查找該工作簿并返回錯誤,如果同一工作簿在多個實例中打開。 要連接到活動應用程序實例中的工作簿,請使用“xw.books”并引用特定應用程序,使用: ~~~ >>> app = xw.App() # 或類似現有應用程序的xw.apps [10559],通過xw.apps.keys()獲取可用的PID >>> app.books['Book1'] ~~~ | ? | xw.Book | xw.books | | --- | --- | --- | | New book | `xw.Book()` | `xw.books.add()` | | Unsaved book | `xw.Book('Book1')` | `xw.books['Book1']` | | Book by (full)name | `xw.Book(r'C:/path/to/file.xlsx')` | `xw.books.open(r'C:/path/to/file.xlsx')` | >[info]注意 在Windows上指定文件路徑時,您應該通過在字符串前放置一個`r`來使用原始字符串,或者使用雙反斜杠:`C:\\path\\to\\file.xlsx`。 ## Excel to Python (RunPython) 要在VBA中使用`RunPython`時引用調用工作簿,請使用`xw.Book.caller()`,參見[VBA: RunPython](vba.md)。 查看有關[調試](debugging.md)的部分,了解如何從雙方(Python和Excel)調用腳本,而無需經常 在`xw.Book.caller()`和上面介紹的方法之一之間進行切換。 ## User Defined Functions (UDFs) 與`RunPython`不同,UDF不需要調用`xw.Book.caller()`,參見[VBA: User Defined Functions (UDFs)](udfs.md)。 但是,它可用(僅限于只讀),有時證明是有用的。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看