انتقل إلى المحتوى الرئيسي

كيفية تصدير بيانات Excel (اختيار أو أوراق) إلى ملفات نصية في Excel؟

إذا كنت مطالبًا بتسليم مصنف بتنسيق ملف نصي ، فأنت بحاجة إلى تحويل المصنف إلى ملفات نصية. وستقدم لك هذه المقالة طريقتين لتصدير بيانات Excel إلى ملفات نصية بسهولة.

تصدير ورقة واحدة إلى ملف نصي في Excel

بشكل افتراضي ، سيتم حفظ بيانات Excel كمصنفات بتنسيق . XLSX. ومع ذلك ، يمكننا تصدير ورقة عمل من مصنف موجود كملفات نصية بامتداد حفظ باسم خاصية. يرجى القيام بما يلي:

1. انتقل إلى ورقة العمل التي ستقوم بتصديرها إلى ملف نصي ، وانقر فوق قم بتقديم (أو زر المكتب)> حفظ باسم.

2. في الافتتاح حفظ باسم في مربع الحوار ، حدد المجلد الوجهة الذي ستحفظ فيه الملف النصي المُصدَّر ، وقم بتسمية الملف بتنسيق اسم الملف ، ثم حدد ملف نص يونيكود (* .txt) من ملف حفظ كنوع قائمة منسدلة. انظر لقطة الشاشة:
تصدير إلى ملف نصي باستخدام ميزة "حفظ باسم"

3. ثم سيظهر مربعي حوار تحذيريين يطالبك بتصدير ورقة العمل النشطة فقط كملف نصي وترك أي ميزات غير متوافقة مع ملف نصي. انقر OK وزر نعم زر على التوالي.

ثم يتم تصدير البيانات الموجودة في ورقة العمل النشطة كملف نصي جديد.

ملاحظات: ال حفظ باسم الأمر قادر فقط على تصدير بيانات ورقة العمل النشطة كملف نصي. إذا كنت ترغب في تصدير جميع بيانات المصنف بأكمله ، فستحتاج إلى حفظ كل ورقة عمل كملف نصي على حدة.


تصدير التحديد (أو عمود واحد) إلى ملف نصي باستخدام VBA

يمكن أن يساعدك رمز VBA التالي أيضًا على تصدير بيانات النطاق المحدد (على سبيل المثال عمود واحد) إلى ملف نصي ، يرجى القيام بذلك على النحو التالي:

1. اضغط باستمرار ALT + F11 مفاتيح ، ويفتح ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

2. انقر إدراج > وحدة، والصق التعليمة البرمجية التالية في نافذة الوحدة النمطية.

VBA: تصدير التحديد أو ورقة العمل بأكملها إلى ملف نصي

Sub ExportRangetoFile()
'Update 20130913
Dim wb As Workbook
Dim saveFile As String
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set wb = Application.Workbooks.Add
WorkRng.Copy
wb.Worksheets(1).Paste
saveFile = Application.GetSaveAsFilename(fileFilter:="Text Files (*.txt), *.txt")
wb.SaveAs Filename:=saveFile, FileFormat:=xlText, CreateBackup:=False
wb.Close
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

3. ثم اضغط F5 مفتاح لتشغيل هذا الرمز. ثم حدد نطاق البيانات الذي تريد تصديره في مربع الحوار المنبثق ، وانقر فوق OK زر ، انظر لقطة الشاشة:
حدد عمودًا واحدًا للتصدير كملف نصي

4. والآن في مربع حوار حفظ باسم آخر ، يرجى تحديد اسم لهذا الملف النصي ومجلد لوضع هذا الملف فيه ، والنقر فوق الزر حفظ .


تصدير التحديد (أو عمود واحد) إلى ملف نصي باستخدام Kutools for Excel

حفظ باسم يمكن للأمر تصدير جميع البيانات في ورقة العمل النشطة كنص. ماذا لو تم تصدير جميع البيانات الخاصة بأوراق العمل المحددة غير النشطة أو جزء من البيانات في ورقة العمل كملف نصي؟ كوتولس ل إكسيل's نطاق التصدير إلى ملف يمكن أن تساعدنا الأداة في تصدير وحفظ البيانات المختارة كملف نصي بسهولة ..  

كوتولس ل إكسيل - مزود بأكثر من 300 أداة أساسية لبرنامج Excel. استمتع بتجربة مجانية كاملة المواصفات لمدة 30 يومًا دون الحاجة إلى بطاقة ائتمان! التحميل الان!

1. حدد النطاق الذي ستصدره إلى ملف نصي (في حالتنا ، نختار العمود A) ، ثم انقر كوتولس بلس > استيراد / تصدير > نطاق التصدير إلى ملف، انظر لقطة الشاشة:
الوظيفة الإضافية Excel: تصدير التحديد إلى ملف نصي

2. في مجلة نطاق التصدير إلى ملف مربع الحوار ، كما هو موضح أدناه لقطة الشاشة:
الوظيفة الإضافية Excel: تصدير التحديد إلى ملف نصي
(1) تحقق من نص يونيكود الخيار في تنسيق الملف قسم.
(2) حدد خيار حفظ القيم الفعلية أو حفظ القيم كما هو موضح على الشاشة كما تريد في قسم خيارات النص ؛
(3) حدد مجلد الوجهة الذي ستحفظ فيه الملف النصي المُصدَّر ؛
(4) انقر فوق Ok .

3. قم بتسمية الملف النصي المُصدَّر في مربع حوار الفتح الجديد ، وانقر فوق ملف Ok .
اسم الملف النصي الذي تم تصديره

ثم تم تصدير التحديد (العمود المحدد أ) كملف نصي وحفظه في المجلد المحدد.

كوتولس ل إكسيل - شحن برنامج Excel بأكثر من 300 أداة أساسية. استمتع بتجربة مجانية كاملة المواصفات لمدة 30 يومًا دون الحاجة إلى بطاقة ائتمان! احصل عليه الآن


تصدير أوراق متعددة لفصل الملفات النصية في Excel

قد تحتاج أحيانًا إلى تصدير أوراق عمل متعددة إلى ملفات نصية متعددة في Excel. قد تكون ميزة حفظ باسم مملة بعض الشيء! لا تقلق! كوتولس ل إكسيل انقسام وركبوك توفر الأداة المساعدة لمستخدمي Excel حلاً سهلاً لتصدير أوراق عمل متعددة إلى العديد من الملفات النصية المنفصلة بنقرات عديدة. 

كوتولس ل إكسيل - مزود بأكثر من 300 أداة أساسية لبرنامج Excel. استمتع بتجربة مجانية كاملة المواصفات لمدة 30 يومًا دون الحاجة إلى بطاقة ائتمان! التحميل الان!

1. انقر كوتولس بلس > مصنفانقسام وركبوك. انظر لقطة الشاشة:
ملحق Excel: تصدير أوراق متعددة إلى ملفات نصية

2. في مربع حوار فتح Split Workbook ، يرجى القيام بما يلي:
ملحق Excel: تصدير أوراق متعددة إلى ملفات نصية
(1) تحقق من أوراق العمل التي ستصدرها إلى ملفات نصية منفصلة في ملف اسم المصنف قسم.
(2) تحقق من حدد تنسيق الحفظ الخيار، ثم حدد نص Unicode (* .txt) من القائمة المنسدلة أدناه ، انظر لقطة الشاشة اليسرى:
(3) انقر فوق الانقسام .

3. ثم في مربع الحوار "استعراض بحثًا عن مجلد" المنبثق ، حدد المجلد الوجهة الذي ستحفظ فيه الملفات النصية المُصدرة ، وانقر فوق OK .

حتى الآن تم تصدير كل ورقة عمل محددة كملف نصي منفصل وحفظها في المجلد المحدد.

كوتولس ل إكسيل - شحن برنامج Excel بأكثر من 300 أداة أساسية. استمتع بتجربة مجانية كاملة المواصفات لمدة 30 يومًا دون الحاجة إلى بطاقة ائتمان! احصل عليه الآن

قم بحفظ كل ورقة بسهولة كملف PDF / text / csv منفصل أو مصنف في Excel

عادة يمكننا حفظ ورقة العمل النشطة كملف .pdf منفصل أو ملف .txt أو ملف .csv مع ميزة "حفظ باسم". لكن كوتولس ل إكسيل انقسام وركبوك يمكن أن تساعدك الأداة المساعدة في حفظ كل مصنف بسهولة كملف PDF / TEXT / CSV منفصل أو مصنف في Excel.


مصنف تقسيم الإعلان pdf 1

كوتولس ل إكسيل - شحن برنامج Excel بأكثر من 300 أداة أساسية. استمتع بتجربة مجانية كاملة المواصفات لمدة 30 يومًا دون الحاجة إلى بطاقة ائتمان! احصل عليه الآن


العرض التوضيحي: تصدير بيانات Excel (التحديد أو الأوراق) إلى ملفات نصية في Excel


كوتولس ل إكسيل: أكثر من 300 أداة مفيدة في متناول يدك! ابدأ تجربتك المجانية لمدة 30 يومًا دون أي قيود على الميزات اليوم. تحميل الآن!

مقالات ذات صلة:

أفضل أدوات إنتاجية المكتب

🤖 مساعد Kutools AI: إحداث ثورة في تحليل البيانات على أساس: التنفيذ الذكي   |  إنشاء التعليمات البرمجية  |  إنشاء صيغ مخصصة  |  تحليل البيانات وإنشاء الرسوم البيانية  |  استدعاء وظائف Kutools...
الميزات الشعبية: البحث عن التكرارات أو تمييزها أو تحديدها   |  حذف الصفوف الفارغة   |  دمج الأعمدة أو الخلايا دون فقدان البيانات   |   جولة بدون صيغة 
سوبر بحث: معايير متعددة VLookup    VLookup ذات القيمة المتعددة  |   VLookup عبر أوراق متعددة   |   بحث غامض ....
قائمة منسدلة متقدمة: إنشاء القائمة المنسدلة بسرعة   |  القائمة المنسدلة التابعة   |  قائمة منسدلة متعددة التحديد ....
مدير العمود: إضافة عدد محدد من الأعمدة  |  نقل الأعمدة  |  تبديل حالة رؤية الأعمدة المخفية  |  مقارنة النطاقات والأعمدة 
الميزات المميزة: التركيز على الشبكة   |  عرض تصميم   |   شريط الفورمولا الكبير    مدير المصنفات والأوراق   |  مكتبة الموارد (النص السيارات)   |  منتقي التاريخ   |  اجمع أوراق العمل   |  تشفير/فك تشفير الخلايا    إرسال رسائل البريد الإلكتروني عن طريق القائمة   |  سوبر تصفية   |   مرشح خاص (تصفية غامق / مائل / يتوسطه خط ...) ...
أفضل 15 مجموعة أدوات12 نص الأدوات (إضافة نص, إزالة الأحرف، ...)   |   +50 رسم الأنواع (مخطط جانت، ...)   |   40+ عملي الصيغ (احسب العمر على أساس تاريخ الميلاد، ...)   |   19 إدخال الأدوات (أدخل رمز الاستجابة السريعة, إدراج صورة من المسار، ...)   |   12 تحويل الأدوات (أرقام إلى كلمات, نتيجة تحويل عملة، ...)   |   7 دمج وتقسيم الأدوات (الجمع بين الصفوف المتقدمة, تقسيم الخلايا، ...)   |   ... و اكثر

عزز مهاراتك في Excel باستخدام Kutools for Excel، واختبر كفاءة لم يسبق لها مثيل. يقدم Kutools for Excel أكثر من 300 ميزة متقدمة لتعزيز الإنتاجية وتوفير الوقت.  انقر هنا للحصول على الميزة التي تحتاجها أكثر...

الوصف


يجلب Office Tab الواجهة المبوبة إلى Office ، ويجعل عملك أسهل بكثير

  • تمكين التحرير والقراءة المبوبة في Word و Excel و PowerPointوالناشر والوصول و Visio والمشروع.
  • فتح وإنشاء مستندات متعددة في علامات تبويب جديدة من نفس النافذة ، بدلاً من النوافذ الجديدة.
  • يزيد من إنتاجيتك بنسبة 50٪ ، ويقلل مئات النقرات بالماوس كل يوم!
Comments (19)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How would I amend the code for Export selection (or one column) to text file with VBA to autofill the filename with the contents of cell B2?
thanks
This comment was minimized by the moderator on the site
Hi,This is great, thanks a lot.
How would I alter the code for Export selection (or one column) to text file with VBA to auto fill the filename with the contents of cell B2?
This comment was minimized by the moderator on the site
Hi, this code is very useful for me. So thank you very much.
I want to ask that: When i'm using this code, a new line append automatically at the end of the txt content.
Can you help me about preventing this by vba?
This comment was minimized by the moderator on the site
hi guys, i used that code:
Sub ExportRangetoFile()
'Update 20130913
Dim wb As Workbook
Dim saveFile As String
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set wb = Application.Workbooks.Add
WorkRng.Copy
wb.Worksheets(1).Paste
saveFile = Application.GetSaveAsFilename(fileFilter:="Text Files (*.txt), *.txt")
wb.SaveAs Filename:=saveFile, FileFormat:=xlText, CreateBackup:=False
wb.Close
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

and have working, but i need to savea column with cells that contain the function"concatenate", and when i play the vba code, and i save the .TXT file, only what appears it's #REF. how can i to fix it? cause i need the data that appears on that cells?
This comment was minimized by the moderator on the site
Has anyone been able to figure this out? I am having the same issue.
This comment was minimized by the moderator on the site
HELLO
THANK YOU FOR YOUR VBA CODE
SOMETIMES ON CERTAIN TEXT THERE IS "TEXT" IN EXPORT .TXT
THANK YOU FOR WHY
This comment was minimized by the moderator on the site
Thanks for the awesome piece of VBA code to export data to a text file. I have used your code with some of my own. The data I am dealing with is extremely line-length specific and after the macro has run, the text file contains some double quotation marks " at random places, which was never present in my data before. I have tried adding a code line to remove this character at various stages but that does not seem to be working. I am aware that I can manually remove this but would like to resolve it in the VBA code.

Sub Macro3()
Dim wb As Workbook
Dim saveFile As String
Dim WorkRng As Range
On Error Resume Next
Selection.AutoFilter
ActiveSheet.Range("$A$1:$B$10591").AutoFilter Field:=1, Criteria1:= _
"=NSZAP*", Operator:=xlAnd
Range("A1").Select
ActiveCell.Offset(200, 0).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Rows("1:10101").EntireRow.Select
Selection.Delete Shift:=xlUp
Range("A1").Select
Selection.AutoFilter
Range(Selection, Selection.End(xlDown)).Select
Set WorkRng = Application.Selection
Set wb = Application.Workbooks.Add
WorkRng.Copy
wb.Worksheets(1).Paste
Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
saveFile = Application.GetSaveAsFilename(fileFilter:="Text Files (*.txt), *.txt")
Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
wb.SaveAs Filename:=saveFile, FileFormat:=xlText, CreateBackup:=False
Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
wb.Close
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
Hi Harish,
For removing a specified character in bulk, you can replace the character with nothing.
Ctrl + H to open the Find and Replace dialog box, type the specified character in the Find what box, and type noting in the replace with box.
This comment was minimized by the moderator on the site
3/2 You might also note that you don't need to specify the wb prefix once you've .Add ed the workbook since it becomes active. Specifying wb might or might not be more efficient but it can be omitted from some commands. Actually I entirely scrapped the variable wb; I just go Workbooks.Add, and use ActiveWorkbook when needed. (As you are suppressing ScreenUpdating it wouldn't be obvious to some that wb is Active. Tip for beginners (and higher): I always, always develop with ScreenUpdating and DisplayAlerts as True, and when done with development, I consider toggling them off for some passage of code.)
This comment was minimized by the moderator on the site
2/2 - vbYesNoCancel msgboxes and Booleans to indicate whether to export all, selection, or a user specified range - a static String for the prior range address - if len(that static)1 then I set WorkRng=activesheet.UsedRange (You can't copy multiple areas with a single copy, though with a little work you could walk the areas and copy them piecemeal.) - Idiotic Microsoft does not save off empty rows at the start and the bottom of the saved range, and does not save off empty columns at the leftmost and the rightmost of the saved range. When I detect that (UsedRange is not row 1, col. 1, or xlLastCell is not completely lower-right) I msgbox to ask user if they want to plug A1 or the lower right cell. - Then I decided to preemptively address the upper left issue by inserting a row and setting A1 to be text like "The following is for range " - I close with activeworkbook.close SaveChanges:=False - Long time habit since I'm an angry proponent of cleaning up (and the world is a sad place thanks to irresponsible programmers who shirk that responsibility when it matters), I set WorkRng = Nothing on the way out :)
This comment was minimized by the moderator on the site
1/2 (since your software limits comment length) I am a serious coder and I want to inform you that the VBA code here is outstanding. It's clean, and not one line too much, or one too few. It's exemplary coding for demonstration of the process. I'll also mention that as I extensively researched solutions for export of selection, you and only one other person suggested dropping the range into a temp new workbook. All other answers were painfully manually, walking through cell by cell. Even Chip's code is much longer and runs slower (but intentionally so, as it is much more flexible - specifiable delimiters, etc.) Just for your amusement, I made some very minor tweaks but otherwise nearly lifted the code word for word because it basically dropped right into a very intricate and specialized application. Some of these tweaks are something I'm sure you do in practice, but they add lines of code (e.g. error checking) so showing them on this webpage would have muddied your display so that the essential elements of processing would have been cumbersome for readers to follow along. Anyway: (see part 2)
This comment was minimized by the moderator on the site
My query is as mentioned below: I have a report to generate everyday. The data what I get on the final row (only one row but more than one columns) I want it to export to another excel sheet which is a summary excel sheet saved separately on my desktop. Eg: Day1 report - final row export to Summary excel sheet row1 Day2 report - final row export to Summary excel sheet row2 Day3 report - final row export to Summary excel sheet row3 and so on.. Export should be done through a click button., which means when I click on export button the data on the sheet I calculated today should go and save on the Summary excel sheet row1, next day a new excel sheet report calculated should go and save on the Summary excel sheet row2 and so on.. Will this be possible to do... If yes please someone help me on this... Thank you in advance...:-)
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations